Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot use git commands inside a step

Hi,

I keep getting the error `fatal: Not a valid object name master` on commands that use git. Even when fetching all refs in the same step or just before the command.

Any ideas? :)

1 answer

1 accepted

1 vote
Answer accepted

The git error "fatal: Not a valid object name master" shows that the local repository has no branch named "master". That branch is important as it is the main branch name for git and some git commands depend on it, e.g. the one that fails in your case.

This is despite you fetched all the remote references (incl. the branches and especially the remote master branch) because all remote branches are prefixed with remote/<remote-name>/<remote-branch-name> in the local repository.

To fetch the remote master branch as the local master branch to create it locally as well, use git fetch:

git fetch origin master:master

Do this before the git command that previously failed and it should work. 

References:

Thanks a lot @ktomk !

That's indeed the proper answer. I used to try to fetch references using the remote syntax instead.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

752 views 12 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you