3

Whenever I need to push my new local commits to GitHub I use the Windows GitHub desktop application. I open it up and click the sync button. I want to be able to do it from the Git Bash command line. I think the command I want to use is:

git push origin master

but when I do that I get some sort of invalid username error. I tried this:

https://stackoverflow.com/a/20871910/280319

but when I do that and git push origin masterI get another error saying git@github.com:user/repo.git is an invalid repo.

Now I'm at the point where I changed my origin back to https://github.com/user/repo.git(I think that's what it was set to before). But since I did that my local repo is now not "pointing" to the correct remote(I can tell because git status doesn't list 1 out of sync commit and neither does the GitHub desktop app).

This is all just on a test repo of mine.

So what do I have to do so that I can push to GitHub using the Git Bash command line?

Community
  • 1
  • 1
Ryan
  • 5,883
  • 13
  • 56
  • 93

1 Answers1

-1

Usually what I do in this situation is just "start over". It is probably not the optimal way to do this, but it works.

  1. Back up your commits, for example to back up the last 4 commits that have not been pushed

    git format-patch -4
    
  2. Re clone the repo

    git clone https://github.com/svnpenn/a
    
  3. Apply your commits. Note since you said Windows, you might need to add --keep-cr here

    git am ../0001-type-magick-dev-null-exit.patch
    
  4. try pushing again

Zombo
  • 1
  • 62
  • 391
  • 407