When I try to push my application to GitHub using Git, I get the following:
$ git push origin master
Enter passphrase for key '/c/Users/Medicine - SWEng/.ssh/id_rsa':
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
Output of running git remote -v
:
$ git remote -v
heroku git@heroku.com:young-rain-273.git (fetch)
heroku git@heroku.com:young-rain-273.git (push)
origin git@github.com:SWEngineer7sample_app.git (fetch)
origin git@github.com:SWEngineer7s开发者_运维问答ample_app.git (push)
sample git@github.com:SWEngineer/sample_app.git (fetch)
sample git@github.com:SWEngineer/sample_app.git (push)
How can I solve this issue?
The error message is clear (and correct):
ERROR: Repository not found.
The problem is that origin
is set to git@github.com:SWEngineer7sample_app.git
which is surely wrong. Obviously, you didn't press SHIFT-7, but only 7 when entering the repo path, therefore there's a 7 where there should be a /. Simply a typo.
origin
should be defined same as sample
(git@github.com:SWEngineer/sample_app.git
), then GitHub will also find a repo.
To resolve this,
git remote rm origin
git remote add origin git@github.com:SWEngineer/sample_app.git
You might also get "ERROR: Repository not found" if you are trying to push to a repo for which you do not have push access. It would be nice if the error were more clear, but if (for example) you are pushing to someone else's repo, check with the owner to make sure you have push access.
According to Help.GitHub - Remotes:
First you need a repo on GitHub you can push to. Either create a new repo, gain collaborator permissions on someone else’s repo, or fork someone else’s repo. You can only push to an ssh URL like git@github.com:user/repo.git or an https URL such like https://user@github.com/user/repo.git. If you cloned another repo with a read-only URL you can add a second remote for your URL or remove or rename the existing remote.
You have a public key issue. Use a key with no password, and simply press enter when prompted for one when making it.
Use ssh to the GitHub repository with the -vvvv
parameter to see which SSH key is being offered.
精彩评论