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?

u32i64
  • 2,384
  • 3
  • 22
  • 36
Tawnwen
  • 1
  • 1
  • 2
  • 1
    To help debug, could you post the output of executing `git branch`? – vasilyrud Mar 26 '18 at 00: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. – Tawnwen Mar 26 '18 at 01: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`. – vasilyrud Mar 26 '18 at 01: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! – Tawnwen Mar 26 '18 at 01:25
  • 1
    In that case, try following the answer given here (specifically about renaming `Master` to `master` in `.git/refs/heads`): https://stackoverflow.com/questions/38034866/cant-push-to-remote-branch-cannot-be-resolved-to-branch/42802253 – vasilyrud Mar 26 '18 at 01:26
  • @vasilyrud Finally fixed after two days! Thanks so much. – Tawnwen Mar 26 '18 at 01:50
  • Possible duplicate of [Can't push to remote branch, cannot be resolved to branch](https://stackoverflow.com/questions/38034866/cant-push-to-remote-branch-cannot-be-resolved-to-branch) – u32i64 Mar 26 '18 at 07:12

0 Answers0