我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
这对我来说很管用:
1. 的遥控器
$ git remote rm origin
$ git remote add origin git@github.com:<USER>/<REPO>.git
如果您的SSH密钥已经在另一个github代表上使用,您可以生成一个新密钥。
2. 生成新的SSH密钥
$ ssh-keygen -t rsa -b 4096 -C "web@github.com"
3.在SSH代理级别添加密钥
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa_github
4. 将新密钥添加到Github回购。
其他回答
git remote rm origin
git remote add origin <remote url>
在使用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帐户添加为存储库中的合作者之一。之后我就可以克隆这个项目了。
只需使用SSH远程url,而不是HTTPS
SSH访问检查方法如下:
ssh -T git@github.com
这个问题是因为我没有在存储库中添加SSH上的人响应,阅读更多关于SSH link-1, link-2的信息。
一个问题,这可能是显而易见的一些,我没有看到这里提到,可能是你有ssh密钥访问,但你正试图通过https连接你的本地回购到远程。
如果是这种情况,那么下面的命令应该可以解决这个问题:
$ git remote -v
origin https://github.com/private-repo.git (fetch)
origin https://github.com/private-repo.git (push)
$ git remote rm origin
$ git remote add origin git@github.com:private-repo.git
$ git remote -v
origin git@github.com:private-repo.git (fetch)
origin git@github.com:private-repo.git (push)
请注意,上述工作的前提是: 您当前的远程名为origin,并且您已经拥有 生成SSH密钥连接到您的github帐户 你已经有一个SSH密钥与你的github帐户相关联(并在本地连接) 你有正确的权限(读/写)设置在github为这个回购的设置。