我有本地工作副本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
我不确定会有什么问题。
当前回答
这里的问题是你的本地git无法将更改推送到远程 检查你的遥控器是否设置正确
git remote -v
如果没有正确设置,请尝试将您的遥控器设置为
git remote set-url origin https://username@github.com/MyRepo/project.git
然后尝试使用
git push -u origin master
也有可能你的本地git有不同的凭据,请检查一下。
其他回答
虽然前面的回复提供了各种解决方案,但我发现其中最简单的一个是将用户名添加到存储库的URL中
git remote add origin https://your-username@github.com/your-username/repository-name.git
如果你已经定义了存储库(没有添加用户名),你可以按照以下方式更新它:
git remote set-url origin https://your-username@github.com/your-username/respository-name.git
当推送到远程存储库时,git不会从凭据助手中提取任何其他现有存储库的凭据,而是会询问用户/存储库在URL中定义的特定密码。
一般来说,我会不惜一切代价避免使用您的帐户密码,而是使用个人访问令牌。登录github,选择,
Settings > Developer Settings > Personal Access Tokens > Generate new token
只要确保在定义令牌范围时选中repo,并在要求输入密码时输入令牌(而不是您的个人密码)。
我也有同样的问题
通过检查http。在git配置中的代理值(我的是不正确的和不需要的), 因此我删除了http。从git配置的代理值
命令:
列出文件中的配置项
git config --list
删除代理
git config --global --unset http.proxy
问题解决了!
如果你没有写权限,只有读权限,就会发生这种情况。 如果它是一个私有存储库,您应该被添加为合作者。 检查你的证件是否正确。
Git实际上不会说这些事情,它只会说,你的凭证没有发现回购。
祝你好运。
我有同样的问题后,我设置了2FA在我的回购。如果你最近在你的账户上设置了2FA,下面是我解决这个问题的方法:
生成一个个人访问令牌
去设置->开发人员设置->个人访问令牌在你的GitHub帐户。生成一个新的个人访问令牌。确保检查所有与repo访问相关的权限。
删除所有GitHub认证配置(从Mac的keychain)
您需要使用生成的个人访问令牌重新登录,因此要清除笔记本电脑上以前的所有身份验证细节。对于mac,打开keychain并从登录/密码部分删除所有github.com相关细节。
用你的GitHub用户名和PAT作为密码登录到你的终端。
如果您在帐户上设置了2FA,则无法使用您的帐户进行身份验证 来自终端的GitHub密码。现在,尝试推送到GitHub回购以触发身份验证需求。你的终端上会弹出一个输入你的GitHub用户名的请求。输入您的用户名,并在提示输入密码时,使用生成的个人访问令牌作为密码。
这些步骤为我解决了问题。
操作系统
使用VS Code和一个没有密码的密钥:
removed eval "$(ssh-agent -s)" line from my ~/.zshrc file to stop running it in the background (first step on Github's Generating a new SSH key article) verified my .ssh/config entry for *.github.com did not have a UseKeychain line used simply ssh-add ~/.ssh/id_ed25519 with NO --apple-use-keychain on VS Code "Git: Add remote..." allowed/authorized my Github account connection (you don't really need to add a remote) applies a new "vscodevscode.github-authentication" entry in Mac's Keychain Access app closed all shells and VS Code, restarted and the repo is now always found