我有本地工作副本的SourceTree。所有操作都很好,我可以通过SourceTree轻松地进行获取、推送、拉取等操作。我只需要进行强制推送,但在SourceTree中不存在此选项。
我打开终端并执行了git push -f。
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定有什么问题。
我有本地工作副本的SourceTree。所有操作都很好,我可以通过SourceTree轻松地进行获取、推送、拉取等操作。我只需要进行强制推送,但在SourceTree中不存在此选项。
我打开终端并执行了git push -f。
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定有什么问题。
从系统中删除所有关于github.com的凭据信息。
适用于Mac:
从Keychain Access中删除github.com的密码。
适用于Windows:
从Credential Manager中删除凭据信息。
我也遇到了同样的问题。
remote: Repository not found
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我卸载了git凭据管理器,重新安装后就可以轻松地拉取和推送到代码库。以下是命令:
$ git credential-manager uninstall
$ git credential-manager install
这个信息出现在找到了一个代码库,但我们没有提交权限的情况下。措辞不够优雅!
我在克隆我的老板为我创建的 gitHub 代码库后收到了“未找到代码库”的消息。我可以在本地克隆和提交,但无法将提交推送到远程代码库。代码库所有者没有给我写入权限。通过请求代码库所有者赋予我写入权限来解决此问题。
因为您可能尚未在终端中标识远程 Git 存储库。
git remote set-url origin https://github.com/MyRepo/project.git
或者如果你正在使用SSH;
git remote set-url origin git@github.com:MyRepo/project.git
然后,
git add .
git commit -m "initial commit"
git push origin master
自2021年以来,Github支持PAT,而不是用户名和密码(请在此处了解如何创建和使用),因此我们只需将其添加到远程origin
中即可。
在Windows上
.git
文件夹并打开config
文件进行编辑。例如:vim config
。https://github.com/<username>/<repo_name>.git
https://[personal-access-token]@github.com/<username>/<repo_name>.git
[personal-access-token]
是您在GitHub上创建的PAT哈希值。config
文件,现在推送应该可以工作了。快捷方式:
git remote remove origin
git remote add origin https://[personal-access-token]@github.com/username/repo_name.git
对于Linux用户:
git remote rm origin
git remote add origin https://GITHUB_USERNAME:PERSONAL_ACCESS_TOKEN@github.com/GITHUB_USERNAME/REPO_NAME.git
问题在于您的本地git无法将更改推送到远程仓库。请检查您的远程设置是否正确:
git remote -v
如果没有正确设置,请尝试将您的遥控器设置为
git remote set-url origin https://username@github.com/MyRepo/project.git
然后尝试使用推送
git push -u origin master
另外,您的本地git可能有不同的凭据,请也检查一下。
在Windows上:
保存并推送代码,它将正常工作。
在Mac上
如果您正在尝试克隆存储库...那么这个问题可能是因为您在钥匙串访问中没有存储你的github账户。为了解决该问题,请尝试使用帐户名称进行克隆,如下所示:
git clone https://username@github.com/org/repo.git
替换