我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。
我打开终端使git按-f
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定会有什么问题。
我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。
我打开终端使git按-f
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定会有什么问题。
当前回答
如果回购是私有的,请确保您已接受回购邀请。如果回购是私有的,而不接受回购邀请,如果你直接推送更改,它会给出相同的错误。
其他回答
在我的情况下,上述解决方案都不起作用。
我通过将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
这可能是身份验证的问题。SourceTree缓存你的github凭据(用于通过https访问存储库),但从终端你必须使用凭据配置git (https://help.github.com/articles/creating-an-access-token-for-command-line-use/)或使用git+ssh和ssh密钥对(https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/)。
有时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存储库标识到您的终端。
git remote set-url origin https://github.com/MyRepo/project.git
然后,
git add .
git commit -m "initial commit"
git push origin master
我在Windows10系统中也遇到过同样的问题。
这里的问题是您在系统中的用户名。您可以使用
git credential-manager uninstall
git credential-manager install
如果它不起作用,那么你必须在你的系统中安装ubuntu,在应用商店中可以买到。
在那个ubuntu终端,我强制推送存储库,它在问我用户名和Passwordstrong文本后工作