Mat*_*der 58 git github atlassian-sourcetree
我有SourceTree和本地工作副本.所有操作都运行良好,我可以通过SourceTree简单地获取,推送,拉取等.我只需要在SourceTree中进行强制推送.
我打开终端制作git push -f
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
Run Code Online (Sandbox Code Playgroud)
我不确定会出现什么问题.
Igo*_*kin 84
Since since 2021 Github supports PAT rather than name/password (read here how to create and use one) so we just add it into the remote origin
.
On Windows
.git
folder and open config
file for editing. Eg. vim config
.https://github.com/<username>/<repo_name>.git
https://[personal-access-token]@github.com/<username>/<repo_name>.git
[personal-access-token]
is the PAT hash you've created at github.config
file and now the push should work.Shortcut:
git remote remove origin
git remote add origin https://[personal-access-token]@github.com/username/repo_name.git
Run Code Online (Sandbox Code Playgroud)
When generating a token, choose No expiration if you want it to work for long time.
Zee*_*ari 69
从系统中删除所有github.com凭据详细信息.
对于mac
从Keychain Access中删除github.com密码.
对于窗口
从Credential Manager中删除凭据.
小智 43
我也面临同样的问题
remote: Repository not found
fatal: repository 'https://github.com/MyRepo/project.git/' not found
Run Code Online (Sandbox Code Playgroud)
我卸载了git凭证管理器并重新安装它然后我可以轻松地拉动并推送到存储库.这是命令
$ git credential-manager uninstall
$ git credential-manager install
Run Code Online (Sandbox Code Playgroud)
saw*_*ala 21
在 Mac 上
如果您尝试克隆 repo.... 那么可能会出现此问题,因为Keychain Access中的 github 帐户中没有 repo 。为了解决问题,请尝试使用帐户名称进行克隆,例如
git clone https://username@github.com/org/repo.git
代替
Emr*_*lat 19
因为您可能没有首先将远程git存储库识别到您的终端.
git remote set-url origin https://github.com/MyRepo/project.git
Run Code Online (Sandbox Code Playgroud)
然后,
git add .
git commit -m "force push"
git push origin master --force
Run Code Online (Sandbox Code Playgroud)
小智 17
找到存储库时可能会出现此消息,但我们没有提交访问权限.措辞不好!
克隆了我老板为我创建的gitHub存储库后,收到了repo-not-found消息.我可以在本地克隆和提交,但无法向上游推送提交.存储库所有者没有给我写入权限.解决了对回购所有者的写入权限的请求.
Pb *_*ies 17
在 Windows 上:
保存并推送代码,它将起作用。
Raz*_*lez 14
如果您没有写访问权限而只有 read ,则可能会发生。
如果它是私有存储库,您应该被添加为合作者。
检查您的凭据是否正确。
Git实际上不会说这些事情,它只会说用你的凭据没有找到repo。
祝你好运。
Muk*_*ria 13
请在下面找到有效的解决方案:
moh*_*sen 13
对于 Mac
打开 KeyChain Access 并在密码类别中找到您的 pssword 帐户(您可以在右上角的钥匙串访问页面上搜索它)
找到后,删除与 git 源代码管理相关的所有键。然后再试一次
Dhe*_*n M 13
您之前可能使用其他一些 GitHub 凭据登录。正是这就是发生此错误的原因。
通常,mac 会将您的 GitHub 凭据存储到钥匙串访问工具。您以前的 git 帐户详细信息在那里。因此它与您当前在其他帐户中的 git repo 不匹配。
解决方案简单明了,
就是这样,给你。
尝试再次推动。它会询问您 git 用户名和密码。您的新凭据将再次存储在钥匙串中,您的推送将完成。
欢呼!
如果您需要更多帮助,请回复我。
谢谢
Mod*_*odX 12
就我而言,上述解决方案均无效。
我通过remote.origin.url
从https切换到ssh解决了这个问题:
验证git配置:
git config --list
Run Code Online (Sandbox Code Playgroud)
应该是这样的:
...
remote.origin.url=https://github.com/ORG/repo-name.git
...
Run Code Online (Sandbox Code Playgroud)
remote.origin.url
使用ssh更新:
git remote set-url origin git@github.com:ORG/repo-name.git
Run Code Online (Sandbox Code Playgroud)
对于 Linux 用户:
git remote rm origin
git remote add origin https://GITHUB_USERNAME:PASSWORD@github.com/username/reponame.git
我使用gh
命令行工具(顺便说一句,这太棒了)
就我而言,我登录到了另一个 github 帐户。我只需要运行:
gh auth logout
gh auth login
Run Code Online (Sandbox Code Playgroud)
然后使用正确的帐户完成身份验证流程。
小智 8
禁用 GIT 凭证对我有帮助:
git config --global --unset credential.helper
Run Code Online (Sandbox Code Playgroud)
这是您的本地git无法将更改推送到远程服务器的问题。
git remote -v
Run Code Online (Sandbox Code Playgroud)
如果未正确设置,请尝试将您的遥控器设置为
git remote set-url origin https://username@github.com/MyRepo/project.git
Run Code Online (Sandbox Code Playgroud)
然后尝试使用
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
另外,您本地的git有可能具有不同的凭据,请也进行检查。
虽然之前的回复提供了各种解决方案,但我发现其中最简单的一种是将用户名添加到存储库的 URL 中
git remote add origin https://your-username@github.com/your-username/repository-name.git
Run Code Online (Sandbox Code Playgroud)
如果您已经定义了存储库(不添加用户名),您可以按如下方式更新它,
git remote set-url origin https://your-username@github.com/your-username/respository-name.git
Run Code Online (Sandbox Code Playgroud)
当推送到远程存储库时,git 不会从凭证助手中提取任何其他现有存储库的凭证,但会询问用户/存储库的特定密码。
作为一般说明,我会不惜一切代价避免使用您的帐户密码,而是使用个人访问令牌。登录github并选择,
Settings > Developer Settings > Personal Access Tokens > Generate new token
Run Code Online (Sandbox Code Playgroud)
只需确保在定义令牌范围时检查repo,并在要求输入密码时输入令牌(而不是您的个人密码)。
我面临同样的问题并通过解决
git add .
git commit -m "message"
git remote set-url origin https://YOUR_GITHUB_USER@github.com/aceofwings/RotairERP.git
Run Code Online (Sandbox Code Playgroud)
然后
git pull
Run Code Online (Sandbox Code Playgroud)
有时,您的电脑上会设置 ssh 凭据以与 github 存储库进行通信。当您设置新的存储库时:如果您以 https 格式添加源,您的 git 凭证管理器将无法识别该存储库。
检查原始格式
git remote -v
Run Code Online (Sandbox Code Playgroud)
来源为 https 格式
origin https://github.com/username/repo_name.git
Run Code Online (Sandbox Code Playgroud)
ssh 格式的来源
origin git@github.com:username/repo_name.git
Run Code Online (Sandbox Code Playgroud)
删除 https 格式的源
git remote remove origin
Run Code Online (Sandbox Code Playgroud)
以 ssh 格式添加源
git remote add origin git@github.com:username/repo_name.git
Run Code Online (Sandbox Code Playgroud)
所以您的网址目前如下所示
https://github.com/RevanthM/Log_Monitoring
它需要看起来像这样
https://RevanthM@github.com/RevanthM/Log_Monitoring
不同之处在于,我在 url 的开头添加了我的 github 用户名,后跟 @ 符号。
小智 5
在我的 repo 上设置 2FA 后,我遇到了同样的问题。如果您最近在您的帐户上设置了 2FA,我是这样做的:
转到GitHub 帐户上的设置 -> 开发人员设置 -> 个人访问令牌。生成新的个人访问令牌。确保检查所有与 repo-access 相关的权限。
您需要使用生成的个人访问令牌重新登录,因此请从您的笔记本电脑中清除所有以前的身份验证详细信息。对于 Mac,打开钥匙串并从登录名/密码部分删除所有与 github.com 相关的详细信息。
如果您在您的帐户上设置了 2FA,您将无法从终端使用您的 GitHub 密码进行身份验证。现在,尝试推送到 GitHub 存储库以触发身份验证需求。输入您的 GitHub 用户名的请求将在您的终端上弹出。输入您的用户名,并在提示输入密码时,使用生成的个人访问令牌作为密码。
这些确切的步骤为我解决了这个问题。
就我而言,由于用户错误,我无法克隆 github。
转到~/.gitconfig
然后尝试删除这行代码(只需删除它然后保存文件)。
[user]
name = youruser
email = youruser@domain.com
Run Code Online (Sandbox Code Playgroud)
或尝试在您的 cmd 或终端中使用一个班轮: git config --global --remove-section user
并尝试再次执行 git clone 。希望它会解决你的一天。><
对此的解决方案 -
问题 -
$ git clone https://github.com/abc/def.git
Cloning into 'def'...
remote: Repository not found.
fatal: repository 'https://github.com/abc/def.git/' not found
Run Code Online (Sandbox Code Playgroud)
解决方案—— 卸载凭证管理器——
abc@DESKTOP-4B77L5B MINGW64 /c/xampp/htdocs
$ git credential-manager uninstall
abc@DESKTOP-4B77L5B MINGW64 /c/xampp/htdocs
$ git credential-manager install
Run Code Online (Sandbox Code Playgroud)
有用....
无需从凭证管理器中删除现有凭证
您所需要的只是在github.com之前添加您的 github用户名@到您的克隆命令中,如下所示:
git clone https://username@github.com/MyRepo/MyProject.git
Run Code Online (Sandbox Code Playgroud)
将会出现身份验证提示,您必须登录 github 帐户,身份验证将成功并且您的存储库将被克隆。
我被这个问题困扰了很长时间,直到了解了Git的配置系统后才得到确切的解决方案。
Git 用于将特定的 github 帐户凭据链接到存储库,这意味着每个存储库只能初始化一个 github/gitlab 帐户,以便将任何更改推送/拉取到存储库的远程源,这是完全有意义的。
另一个需要记住的警告是,在设置 git 配置时,您是在本地还是全局设置用户名和电子邮件(我更愿意根据存储库将我的用户名和电子邮件保留在本地,因为我必须在同一台机器,即一个个人帐户,另一个用于工作场所),或者您最终会提交一个意外的用户名,如果您坐在办公室沙发上做自由职业,这可能会暴露您的电子邮件。
归档时间: |
|
查看次数: |
104458 次 |
最近记录: |