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

我打开终端使git按-f

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

我不确定会有什么问题。


当前回答

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

其他回答

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

Linux用户:

Git远程rm来源

git远程添加origin https://GITHUB_USERNAME:PERSONAL_ACCESS_TOKEN@github.com/username/reponame.git

生成新令牌

我在Windows10系统中也遇到过同样的问题。

这里的问题是您在系统中的用户名。您可以使用

git credential-manager uninstall

git credential-manager install

如果它不起作用,那么你必须在你的系统中安装ubuntu,在应用商店中可以买到。

在那个ubuntu终端,我强制推送存储库,它在问我用户名和Passwordstrong文本后工作

检查url s.source是否正确。

为我树立榜样

// fail Project>>t<<est

s.source = { :git => '.../Projecttest-iOS', :tag => s.version.to_s }

// success    Project>>T<<est
s.source = { :git => '.../ProjectTest-iOS', :tag => s.version.to_s }

在ubuntu上,我遇到了这个问题。我通过运行下面的命令重置凭据帮助器来解决这个问题。

git config credential.helper "" 

运行此命令后,当您拉或推时,将要求您再次输入凭据。