我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。

我打开终端使git按-f

remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found

我不确定会有什么问题。


当前回答

禁用GIT证书对我有帮助:

git config --global --unset credential.helper

其他回答

如果你正在使用Git桌面应用程序,那么你应该尝试从Git桌面应用程序中推和拉,而不是终端。它会帮助你的。

I was trying to clone a repo and was facing this issue, I tried removing all git related credentials from windows credentials manager after that while trying to clone git was asking me for my credentials and failing with error invalid username or password. This was happening because the repo I was trying to clone was under an organization on github and that organization had two factor auth enabled and git bash probably do not know how to handle 2fa. So I generated a token from https://github.com/settings/tokens and used the github token instead of password while trying to clone the repo and that worked.

这里的问题是你的本地git无法将更改推送到远程 检查你的遥控器是否设置正确

git remote -v

如果没有正确设置,请尝试将您的遥控器设置为

git remote set-url origin https://username@github.com/MyRepo/project.git

然后尝试使用

git push -u origin master

也有可能你的本地git有不同的凭据,请检查一下。

如果你没有写权限,只有读权限,就会发生这种情况。 如果它是一个私有存储库,您应该被添加为合作者。 检查你的证件是否正确。

Git实际上不会说这些事情,它只会说,你的凭证没有发现回购。

祝你好运。

从系统中删除所有github.com凭据详细信息。

对于mac

从Keychain Access中删除github.com密码。

对于windows

从凭证管理器中删除凭证。