I\'m on Ubuntu 12.04 LTS and just upgraded my git
from 1.7
-something to version 1.8.4
. The problem is when I want to push to a GitHub repo
I had the same problem as you. But A little different with you.
Username for 'https://www.github.com': xxxx@gmail.com
Password for 'https://xxxx@gmail.com@www.github.com':
remote: Anonymous access to xxxxx.git denied.
fatal: Authentication failed for 'https://www.github.com/yyyy/xxx
And I found the cause of problem is that I clone with the prefix of www https://www.github.com/yyyy/xxx
I solved it by git clone the repository again like this https://github.com/yyyy/xxx
, and everything go right.
The issues was not resolved however in the end I decided to go with SSH instead of HTTPS. SSH caused no problems at all (and there's no need to type in the username and pass)!
If you want to use your SSH key, you must use the following format:
$ <snip> on MBP-0x00A3 in ~/misc/vim_dotfiles
✭ (git) working on branch alternate ✔
❯❯ git remote -v
origin https://github.com/<snip>/vim_dotfiles.git (fetch)
origin https://github.com/<snip>/vim_dotfiles.git (push)
$ <snip> on MBP-0x00A3 in ~/misc/vim_dotfiles
✭ (git) working on branch alternate ✔
❯❯ git remote add personal git@github.com:<snip>/vim_dotfiles.git
$ <snip> on MBP-0x00A3 in ~/misc/vim_dotfiles
✭ (git) working on branch alternate ✔
❯❯ git remote -v
origin https://github.com/<snip>/vim_dotfiles.git (fetch)
origin https://github.com/<snip>/vim_dotfiles.git (push)
personal git@github.com:<snip>/vim_dotfiles.git (fetch)
personal git@github.com:<snip>/vim_dotfiles.git (push)
Now you can do:
user@host:~$ git push personal <branch>
and it will force use of your SSH key.
I faced a similar problem and got to this question in the search for an answer.
Figured out the issue.
git push
without adding any files can give this errorgit push
without adding any commits can do the sameso the simple solution would be to follow this
git add --all .
git commit
git push
I had this issue due to the fact that I had 2-Factor-Auth enabled, and the password it was asking for was the generated password / personal access token, not my LDAP password. I didn't remember that I had set it up at the time.
Creating a Personal Access Token: https://help.github.com/articles/creating-an-access-token-for-command-line-use/ , allowed me to push successfully using the generated token as a password.
Context: Internally hosted Enterprise Github. Able to clone, enabled as a collaborator, but unable to push origin master.