Reputation: 6466
Trying to add a blank sample app for a rails tutorial to GitHub, but I get this error (apparently common, but I searched through other posts for a solution and couldn't find one that works for me).
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
I get the error both when I try what the rails tutorial suggests:
$ git remote add origin [email protected]:<username>/sample_app.git
$ git push -u origin master
and then the pretty similar prompt that the github repository I created says to try:
$ git remote add origin https://github.com/<username>/sample_app.git
$ git push -u origin master
I've been doing this from within the sample_app directory and after committing:
$ git commit -a -m "Improve the README"
(which is the last change I made and the only one before trying to push it to github)
Help?
Upvotes: 2
Views: 3849
Reputation: 3880
One of the weird things about doing these operations on a Windows machine is that Windows credentials Manager can cache your GitHub username and password, and that always gets sent across the wire, even when you hard-code your u/p right into the URL. Going into Windows Credentials Manager and clearing the GitHub account credentials can sometimes help.
Five other common reasons for encountering the git fatal: repository not found error include:
Upvotes: 0
Reputation: 5290
Another reason this can happen: when you connect to a remote server, the ssh keys are not loaded. To get around this, you can set up forwarding in ~/.ssh/config
:
Host *
ForwardAgent yes
This will ensure that when you connect to github from another server, that your keys stay loaded.
Upvotes: 1
Reputation: 84343
You need to create the repository on GitHub first, before you attempt to push to it. If you can't get the push to work, try:
The clone will have your remotes set properly, so that's usually an easier way to go.
Upvotes: 2