我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
eval "$(ssh-agent -s)"
这是我自己的回购——应该有足够的使用权。对于其他回购,我能够拉和推没有问题。通过重新启动ssh-agent解决了这个问题。我用macos。
其他回答
如果你在Windows上使用Git,试着清除你的凭证:
找到“凭据管理器”(应该在控制面板中) 删除所有与GitHub相关的凭证
如果你使用https从github克隆,但你使用ssh推送,你也会得到这个错误。
要纠正这个问题,打开.git/config并替换:
Url = https://github.com/company/project.git
With
Url = git@github.com:company/project.git
你应该可以在没有任何警告的情况下推…
下面为我解决了这个问题。
首先,我使用这个命令来确定使用的github帐户是什么:
ssh -T git@github.com
这给了我一个这样的答案:
Hi <github_account_name>! You've successfully authenticated, but GitHub does not provide shell access. I just had to give the access to fix the problem.
然后我明白了答案中描述的Github用户(github_account_name)在我试图拉的Github存储库上没有授权。
我也遇到了同样的问题,我通过在回购url中包含我的用户名和密码来解决它:
git clone https://myusername:mypassword@github.com/path_to/myRepo.git
我得到了同样的错误
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
我在Github上创建了存储库,并在本地克隆了它。
我可以通过打开.git/config并删除[remote "origin"]部分来解决。
[remote "origin"]
url = git@github.com:alexagui/my_project.git
fetch = +refs/heads/*:refs/remotes/origin/*
然后我运行以下程序(再次)
git remote add origin git@github.com:alexagui/my_project.git
git push -u origin master
这一次我可以推到存储库。