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

我打开终端使git按-f

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

我不确定会有什么问题。


当前回答

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

其他回答

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

我通过将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

在我的情况下,我不能克隆github由于用户是错误的。

转到~/.gitconfig 然后尝试删除这行代码(只需删除它,然后保存文件)。

[user]
    name = youruser
    email = youruser@domain.com

或者尝试在CMD或终端中使用一行代码:git config——global——remove-section user

并尝试再次做git克隆。希望它能帮你度过美好的一天。><

有时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

在Visual Studio中从Github克隆时,点击Github链接上的“浏览存储库”选项,它将要求登录。

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.