问题
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 master
I 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?
回答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.
Back up your commits, for example to back up the last 4 commits that have not been pushed
git format-patch -4
Re clone the repo
git clone https://github.com/svnpenn/a
Apply your commits. Note since you said Windows, you might need to add
--keep-cr
heregit am ../0001-type-magick-dev-null-exit.patch
try
push
ing again
来源:https://stackoverflow.com/questions/23315583/how-to-push-to-github-using-git-bash