我有一个非常奇怪的问题与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

什么好主意吗?


当前回答

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

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

其他回答

我的解决办法是:

git remote rm origin
git remote add origin https://USERNAME@github.com/username/reponame.git

类似于Emi-C的答案,但没有密码。

SSH访问检查方法如下:

ssh -T git@github.com

这个问题是因为我没有在存储库中添加SSH上的人响应,阅读更多关于SSH link-1, link-2的信息。

我也有同样的问题。

我解决了把我的gitlab用户名前缀到gitlab.com url的问题,就像这样: 之前: https://gitlab.com/my_gitlab_user/myrepo.git 后: https://my_gitlab_user@gitlab.com/my_gitlab_user/myrepo.git 在这种情况下,将再次要求凭据,这就完成了!

Github于2021年8月13日删除了用户名和密码的使用。现在改用个人代币

要克服这一点,请使用create personal token生成个人令牌。并使用下面的代码片段来实现推送和克隆功能。

推动

git remote remove origin
git remote add origin https://[USER]:[TOKEN]@github.com/[USER]/[REPO]
git push

克隆

git clone https://[USER]:[TOKEN]@github.com/[USER]/[REPO]
eval "$(ssh-agent -s)"

这是我自己的回购——应该有足够的使用权。对于其他回购,我能够拉和推没有问题。通过重新启动ssh-agent解决了这个问题。我用macos。