Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repository Not Found when pushing to GitHub remote

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?

like image 484
septerr Avatar asked Apr 17 '12 02:04

septerr


2 Answers

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.

like image 88
Nate Barr Avatar answered Sep 22 '22 11:09

Nate Barr


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

like image 34
ShaunUK Avatar answered Sep 19 '22 11:09

ShaunUK