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

我打开终端使git按-f

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

我不确定会有什么问题。


当前回答

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

git config credential.helper "" 

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

其他回答

您可能正在尝试推送到私有存储库。在这种情况下,您必须请求管理员验证Collaborator访问。

这可能是身份验证的问题。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/)。

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.

如果回购是私有的,请确保您已接受回购邀请。如果回购是私有的,而不接受回购邀请,如果你直接推送更改,它会给出相同的错误。

确保您拥有正确的访问权限,当分支受到保护时可能会发生这种情况。

我刚刚浪费了四个小时在这上面。