我有一个非常奇怪的问题与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
什么好主意吗?
我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
我得到这个错误(但之前正在工作)。我的问题是缺少与Github帐户绑定的ssh密钥。您可以使用ssh-add -l检查当前的ssh密钥。
如果你的钥匙丢失了,你可以用
ssh-add ~/.ssh/your_key
其他回答
只需使用SSH远程url,而不是HTTPS
这是如何解决我的问题
#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
使用Ubuntu时,我总是需要使用SSH而不是HTTPS添加远程
git remote add origin git@github.com:username/project.git
而不是
git remote add origin https://github.com/username/project.git
在使用MacBook Pro时遇到了同样的问题。
当我尝试克隆一个存储库时,我得到以下错误:
git clone https://github.com/mytech/mytech_frontend.git
Cloning into 'mytech_frontend'...
remote: Repository not found.
fatal: repository 'https://github.com/mytech/mytech_frontend.git/' not found
以下是我的解决方法:
问题是我已经在我的电脑上设置了我的个人GitHub帐户,我试图克隆的存储库是个人的私人存储库(而不是团队帐户)。
我所要做的就是通过进入项目设置,将我的个人Github帐户添加为存储库中的合作者之一。之后我就可以克隆这个项目了。
如果你的repo之前工作正常,突然弹出这个错误,最有可能的原因是你的git被认证为其他用户,没有访问存储库的权限。因此,为了进行推送,您所需要做的就是在git命令中指定正确的用户名和密码。所以,一个github回购的推命令看起来像:
git push https://youruser:password@github.com/user/reponame.git
用户名和密码需要进行url转义,因此@应该被%40取代,等等。