0

Here's a screenshot of what I'm dealing with:

I'm a new GitBash user and am getting this error when trying to push to GitHub.

I was following this tutorial. So far I've not run into any problems, except I get this error when I try to push:

Fatal: master cannot be resolved to branch 

Things I've done correctly:

  • I am signed in
  • I have specified my name and email using git config -global... *blah blah*
  • Everything is committed and should be ready to push
  • I'm on the master branch that I wish to push.
  • I've added my remote repository using command git remote add origin https://github.com/Tawnwen/MyApp.git.
  • I tried to push using the command git push -u origin master

Can anyone please help?

7
  • 1
    To help debug, could you post the output of executing git branch? Commented Mar 26, 2018 at 0:57
  • @vasilyrud It's already included in the linked image. However, with some tinkering now my "Master" branch is no longer currently highlighted in green. Commented Mar 26, 2018 at 1:08
  • Ah yes, it looks like you have a branch named Master instead of master. Try creating a new branch (and immediately switch to it) with git checkout -b master and then use that to push to Github with git push -u origin master. Commented Mar 26, 2018 at 1:10
  • @vasilyrud Hm.. the console is telling me that I already have a branch called master. Trying to do git checkout master tells me that I'm already in the master branch. I'm still getting the same error! Commented Mar 26, 2018 at 1:25
  • 1
    In that case, try following the answer given here (specifically about renaming Master to master in .git/refs/heads): stackoverflow.com/questions/38034866/… Commented Mar 26, 2018 at 1:26

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.