我有一个非常奇怪的问题与git和github。当我试着推的时候,我得到:

git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

我添加了遥控器:

git remote add origin git@github.com:account-name/repo-name.git

什么好主意吗?


当前回答

这是如何解决我的问题

#check current github account
ssh -T git@github.com

#ensure the correct ssh key used with github
ssh-agent -s
ssh-add ~/.ssh/YOUR-GITHUB-KEY

#re-add the origin
git remote add origin git@github.com:YOUR-USER/YOUR-REPO.GIT
git push -u origin master

其他回答

我也遇到了同样的问题,我通过在回购url中包含我的用户名和密码来解决它:

git clone https://myusername:mypassword@github.com/path_to/myRepo.git

如果有人在github.com上遇到这个问题,检查你是否接受了回购所有者允许提交给你的邀请。直到你接受邀请,回购将是无形的为您。所以你会得到ERROR: Repository not found。

这是如何解决我的问题

#check current github account
ssh -T git@github.com

#ensure the correct ssh key used with github
ssh-agent -s
ssh-add ~/.ssh/YOUR-GITHUB-KEY

#re-add the origin
git remote add origin git@github.com:YOUR-USER/YOUR-REPO.GIT
git push -u origin master

有类似的问题。问题的根源是我遵循了一些关于向Github添加新存储库的在线教程。

只要去Github,创建一个新的repo,它会要求你添加一个README,不要添加它。创建它,你会得到如何推送的指导。

它类似于接下来的两行:

git remote add origin https://github.com/YOUR_USER/your-repo.git
git push -u origin master

我得到了同样的错误,因为我改变了我的github用户名,然后我这样做:

git remote -v

然后:

git remote set-url newname newurl 
git push -u origin master

这次我能够推送到存储库。 我希望这能有所帮助。