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

我打开终端使git按-f

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

我不确定会有什么问题。


当前回答

我也有同样的问题

通过检查http。在git配置中的代理值(我的是不正确的和不需要的), 因此我删除了http。从git配置的代理值

命令:

列出文件中的配置项

git config --list

删除代理

git config --global --unset http.proxy

问题解决了!

其他回答

因为您可能没有首先将远程git存储库标识到您的终端。

git remote set-url origin https://github.com/MyRepo/project.git

然后,

git add .
git commit -m "initial commit"
git push origin master

您以前可能使用其他GitHub凭据登录。这就是错误发生的原因。

通常,mac将您的GitHub凭据存储到密钥链访问工具。你以前的git帐户详细信息在那里。所以它与你当前在其他账户中的git回购不匹配。

解决方法简单明了,

进入你的mac的钥匙链访问。 在左边的类别下,你可以找到所有的项目。单击。 右边顶部搜索“git”。 你会得到一些关于Github的项目。 删除所有这些项目。

就这样,给你。

再推一下。它会询问你git的用户名和密码。您的新凭证将再次存储在钥匙链中,您的推送将完成。

华友世纪!

如果你需要更多的帮助,再来找我。

谢谢

我有其他现有的github存储库,但我错误地认为我可以使用git命令创建存储库。我认为我的问题是没有个人访问令牌,但我仍然不能使用下面的命令来创建我的存储库。

git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/username/project.git
git push -u origin main

我不断地得到:

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

作为对

git push -u origin main

然而,我发现存储库需要创建使用github cli或在他们的github网站登录到我的帐户后。一旦我这样做了,一切都很顺利。

下面是我发现我不能用git命令创建github存储库的链接。

https://docs.github.com/en/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line

我也有同样的问题

通过检查http。在git配置中的代理值(我的是不正确的和不需要的), 因此我删除了http。从git配置的代理值

命令:

列出文件中的配置项

git config --list

删除代理

git config --global --unset http.proxy

问题解决了!

这里的问题是你的本地git无法将更改推送到远程 检查你的遥控器是否设置正确

git remote -v

如果没有正确设置,请尝试将您的遥控器设置为

git remote set-url origin https://username@github.com/MyRepo/project.git

然后尝试使用

git push -u origin master

也有可能你的本地git有不同的凭据,请检查一下。