gpt4 book ai didi

ubuntu - Git : ERROR: Permission to repo. git 拒绝用户

转载 作者:太空宇宙 更新时间:2023-11-03 16:51:26 25 4
gpt4 key购买 nike

我无法通过 HTTPS 和 SSH 推送(但拉取工作正常)到我公司的 git 存储库,非常感谢这方面的任何帮助。这是一个与此处看到的问题类似的问题:( Git's famous "ERROR: Permission to .git denied to user" ) 除了我正在插入公司 repo 而不是个人 repo - 想知道这是否与公司防火墙有关。

这是我所做的(在已经克隆 repo 之后):

通过 SSH:

git remote set-url origin [SSH url of my company repo]

设置我的 ssh key 并将其添加到我的用户帐户; ssh 到 git@github.com 给我权限被拒绝(公钥),但是 ssh 到 git@git.soma.company.com 验证成功。

git pull
git push origin master

这给了我:

ERROR: Permission to Organization/repo.git denied to user. fatal: The remote end hung up unexpectedly

通过 HTTPS:

git remote set-url origin [HTTPS url of my company repo]
git pull
git push origin master

提示我输入用户名和密码,然后给我:

error: Cannot access URL [HTTPS url of my company repo], return code 22 fatal: git-http-push failed

这是我的 .git/config 的内容:

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [HTTPS url of my company repo]
[branch "master"]
remote = origin
merge = refs/heads/master

我已确认我已被添加为该组织的协作者。删除我自己并重新添加并没有解决问题,删除我的 ssh key 并生成新 key 并将它们添加到我的帐户也没有解决问题。我也试过删除我的整个用户帐户并从头开始设置,以前解决过这个问题,但现在似乎不起作用并产生相同的错误。

一件事是,这个问题最初是在我设置对存储库的 git 访问时发生的,我通过删除我的用户帐户并重新设置来解决它。在接下来的 2 个月里,我能够毫无问题地通过 HTTPS 成功推送到 repo。在团队成员设置访问权限并推送一些代码后,这些错误再次出现;这可能是问题的根源吗?

如果有人能帮助我,我将永远感激不尽。

最佳答案

此错误的发生是因为 github 用户帐户冲突,这意味着可能其他人访问了他的 github 帐户并错误地将他的密码与您的 github 详细信息一起保存

现在每次你试图插入一个仓库时,github 都会面临冲突。

所以解决方案是。如果你是 mac 用户

  1. 打开启动板并搜索钥匙串(keychain)访问权限。
  2. 现在从钥匙串(keychain)帐户中删除您的 github 凭据。
  3. 推送到您的存储库并添加您的帐户详细信息。

对于其他系统尝试改用 Keychain Access 应用程序:

https://help.github.com/articles/updating-credentials-from-the-osx-keychain/#updating-your-credentials-via-keychain-access

关于ubuntu - Git : ERROR: Permission to repo. git 拒绝用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18244982/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com