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

我打开终端使git按-f

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

我不确定会有什么问题。


当前回答

这里的问题是windows凭据管理器,请去控制面板,搜索凭据管理器,并删除它关于github的所有内容

其他回答

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

我有同样的问题,并发现我在~/中有另一个密钥文件。ssh到不同的GitHub存储库。不知怎么的,它代替了新的。

有时ssh凭证是安装在你的电脑上与github回购通信。 当你设置新的repo:如果你添加了https格式的origin,你的git凭证管理器不能找出repo。

检查产地格式

git remote -v

https格式的来源

origin  https://github.com/username/repo_name.git

ssh格式的原点

origin git@github.com:username/repo_name.git

删除https格式的origin

git remote remove origin

添加ssh格式的origin

git remote add origin git@github.com:username/repo_name.git

我通过删除.git文件(隐藏文件夹),然后再次上传解决了这个问题。

我使用gh命令行工具(顺便说一下,这很神奇)

就我而言,我登录了另一个github账户。我只需要运行:

gh auth logout
gh auth login

然后使用正确的帐户进行身份验证流程。