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

我打开终端使git按-f

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

我不确定会有什么问题。


当前回答

操作系统

使用VS Code和一个没有密码的密钥:

removed eval "$(ssh-agent -s)" line from my ~/.zshrc file to stop running it in the background (first step on Github's Generating a new SSH key article) verified my .ssh/config entry for *.github.com did not have a UseKeychain line used simply ssh-add ~/.ssh/id_ed25519 with NO --apple-use-keychain on VS Code "Git: Add remote..." allowed/authorized my Github account connection (you don't really need to add a remote) applies a new "vscodevscode.github-authentication" entry in Mac's Keychain Access app closed all shells and VS Code, restarted and the repo is now always found

其他回答

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

对于mac

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

对于windows

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

在我的情况下,上述解决方案都不起作用。

我通过将remote.origin.url从https切换到ssh来解决这个问题:

验证git配置:

git config --list

应该是这样:

...
remote.origin.url=https://github.com/ORG/repo-name.git
...

使用SSH更新remote.origin.url:

git remote set-url origin git@github.com:ORG/repo-name.git

因为您可能没有首先将远程git存储库标识到您的终端。

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

然后,

git add .
git commit -m "initial commit"
git push origin master

我尝试了所有的方法,直到我意识到存储库所有者只给了我READ权限,所以Git会抛出“remote: repository not found”。

执行git远程更新对我来说很有效。