我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
一个问题,这可能是显而易见的一些,我没有看到这里提到,可能是你有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为这个回购的设置。
其他回答
如果您包括您的用户名和回购名称,我们可以合理地帮助您,目前我们没有理由认为回购确实存在。
此外,如果回购是私有的,并且您无法访问它,github将返回“不存在”,以避免披露私有回购的存在。
编辑:如果你不能克隆它,因为它说它不存在,它是私有的,这是因为你没有发送身份验证。确保您的公钥已添加到密匙环,或暂时使用HTTP基本身份验证。
Normally it happens because the project is private and you have not rights to write it. I had the same "problem" a few times, and it was for that reason. If the project it is yours, just create a private and a public key following this link: https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent and add them to the "SSH and Key" section on gitHub, then you will be able to push to the repo. In the other hand if the project it is not your, ask the owner to give you the rights for it.
我的解决方案可能对你们中的一些人有用。
我把笔记本电脑的操作系统更新到优胜美地后,也出现了同样的错误。通过重新创建ssh密钥,我的问题得到了解决。您可以通过执行本页的第2步完成此操作:https://help.github.com/articles/generating-ssh-keys/
在我的情况下,这是由git使用错误的ssh私钥引起的。 我在学校使用的特定github用户帐户下获得了访问存储库的权限。我的默认ssh私钥不幸链接到不同的github帐户。
如果您使用ssh -T git@github.com ssh将自动使用您的id_rsa私钥连接到github。
使用ssh -i ~/。ssh/<some-key> -T git@github.com应该导致github欢迎您与您链接到该密钥的帐户。
所以在我的情况下发生的是,git正在使用我的默认ssh私钥,该私钥链接到错误的github帐户,该帐户没有访问我试图访问的私有存储库。
为了解决这个问题,我告诉git使用正确的ssh命令在本地git配置我的repo使用命令:git config core。ssh -i ~/.使用实例Ssh /<正确的私钥here>"
查看git配置git config -l应该显示行被正确添加。
这也可能发生,因为GitHub本身宕机了。一定要检查stat.github.com,看看问题是否在他们那边。
2018年10月22日,你有好几个小时都无法推送到GitHub。