Reputation: 6593
I created a repository on GitHub called 'messages' and a local repository with the same name. I am trying to push the files from my local repo to the remote but get this error:
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly.
I figured it was an authentication issue. And when I ran
ssh -T [email protected]
I did get a message indicating that my key did not work. So I added my ~/.ssh/github_rsa.pub to the SSH keys in my account on GitHub (deleted the one that already existed there) and ran the command again. This time I received a message saying -
Hi septerr! You've successfully authenticated, but GitHub does not provide shell access.
From what I read this seemed to be the expected message. So, I again tried the push. But received same error. Repository not found.
Swapnas-MacBook-Pro:messages sony$ git remote -v show
origin [email protected]:seterr/messages.git (fetch)
origin [email protected]:seterr/messages.git (push)
Swapnas-MacBook-Pro:messages sony$ git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
When I look at my repo on GitHub I see:
Existing Git Repo?
cd existing_git_repo
git remote add origin [email protected]:septerr/messages.git
git push -u origin master
What could be wrong?
Upvotes: 11
Views: 63014
Reputation: 53
This is an old post, but I figured I would add an update in case anyone looking at this thread experienced a similar problem and was looking for a fix. I also got a "repository not found" error after successfully logging in; the problem was not due to a typo, but because I hadn't properly defined the scope of my personal access token. If you log in to GitHub using 2FA, you need to use a personal access token in lieu of a password when using the command line. When creating that token, make sure you go down the checklist and give the token the proper scope to read/write to repositories. Otherwise, you'll be able to log in but won't be able to do much else.
More on Scopes at GitHub: https://developer.github.com/apps/building-oauth-apps/scopes-for-oauth-apps/
Upvotes: 0
Reputation: 1646
I contacted github support and they told me to check my git credentials in Windows Credential Manager if I am using a windows machine. Seems that somehow the git credentials were incorrect. I corrected the credentials and push worked.
Upvotes: 0
Reputation: 61
This might help someone, when you add your ssh key to Github, you must add to your profile settings on your user account instead of the repository deploy key.
If you have multiple private repository, this will work for all of them. I did make a mistake by add my ssh key to one of private repository, so when I try to clone the other repository, I got the error "Repository not found..."
Upvotes: 1
Reputation: 1323165
Your remote address is, compared to what github tells you:
[email protected]:seterr/messages.git <== your remote
[email protected]:septerr/messages.git <== GitHub actual repo address
You forgot the 'p
' in septerr
.
As mentioned in "GitHub pushing/pulling error", GitHub repo addresses are sensitive to typo or case.
Nick mentions in the comments:
I ran into an issue where I needed to change my repo address due to a change in GitHub username.
Here's the code for it:
git remote set-url origin [email protected]:username/reponame.git
This will set the remote name to origin with the GitHub username of username.
Upvotes: 6
Reputation: 20590
If you're using OS-X on a Mac and have a HTTPS URL for your remote WITHOUT credentials then the KeyChain may be used for the credentials.
Is it possible that the credentials in your KeyChain are incorrect? Perhaps you have changed your password or you have two github accounts but the wrong one is being used?
If in doubt open the KeyChain app and remove the "github.com" entries then when you next perform a fetch/pull/push etc you will be re-prompted for your github username and password.
All the above assumes that you had previously enabled 'Password/Keychain Caching' as per the guide at https://help.github.com/articles/set-up-git#platform-mac
Upvotes: 5
Reputation: 1781
The problem is username after colon (:). You should use slash and then it works:
git clone ssh://[email protected]/USERNAME/REPONAME.git
The semicolon stands for PORT not username in ssh urls.
git clone ssh://[email protected]:22/REPONAME.git
Upvotes: -2
Reputation: 256
I also had this issue and it turned out to be that I hadn't granted the user access to the repo so the error message was a bit misleading.
Upvotes: 1
Reputation: 4660
I had the same problem. My issue was misunderstanding that I had to first create the empty repo on github before pushing to it. Doh! Including this here for anyone else who doesn't realize.
Upvotes: 9
Reputation: 917
If you are receiving this error and a typo is not the cause, as was my scenario, try opening .git/config and deleting the section:
[remote "origin"]
url = [email protected]:yourgitusername/my_project.git
fetch = +refs/heads/*:refs/remotes/origin/*
Then rerun the following (replace 'yourgitusername'):
git remote add origin [email protected]:yourgitusername/my_project.git
git push -u origin master
This resolved the problem for me. Credit to this answer on a similar question: Git Push ERROR: Repository not found
Upvotes: 14