Sasha
Sasha

Reputation: 6466

GitHub Error Repository Not Found

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

Answers (3)

Cameron McKenzie
Cameron McKenzie

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.

enter image description here

Five other common reasons for encountering the git fatal: repository not found error include:

  1. You did not authenticate
  2. Your password has changed
  3. You are not a collaborator
  4. Incorrect case or a word misspelled
  5. The git repository has been deleted

Upvotes: 0

foz
foz

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

Todd A. Jacobs
Todd A. Jacobs

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:

  1. Creating the repository.
  2. Cloning the new repository from GitHub.
  3. Committing your changes locally and then pushing.

The clone will have your remotes set properly, so that's usually an easier way to go.

Upvotes: 2

Related Questions