【问题标题】:Why can't I do a git push from my repository?为什么我不能从我的存储库执行 git push?
【发布时间】:2019-06-12 22:57:06
【问题描述】:

我最近从我在 GitHub 上的另一个用户帐户克隆了一个 git 存储库,如下所示:

git clone https://github.com/some_user/fav-front.git

我得到了:

remote: Permission to user_current/fav-front.git denied to user_prev.
fatal: unable to access 'https://github.com/user_current/fav-front.git/': The requested URL returned error: 403

但是我仍然可以使用我的当前用户进行 git push。

参考

https://help.github.com/en/articles/cloning-a-repository

https://help.github.com/en/articles/create-a-repo

更新

这似乎是一个身份验证问题。我注意到当我在我的仓库中执行 git config --list 时,我的用户信息都没有被填充。

我尝试手动设置我的用户名和电子邮件,但即使这样也没有用:

~/_top/fav-front> git config user.email 'foo@foo.com'

~/_top/fav-front> git config user.name 'foo'

【问题讨论】:

  • 你是如何验证git clone操作的?
  • 您通常如何在其他仓库中验证git push
  • 检查两个仓库中git remote -v 的输出。这将显示您使用的是 ssh 还是 https。
  • 由于克隆是只读操作,因此不需要身份验证。它不应影响对其他存储库或帐户的任何身份验证。
  • 对不起。我更新了我的问题。 Git 似乎认为我是一个不同的用户。不知道如何排除故障,因为git config --list 没有返回任何内容。

标签: git github


【解决方案1】:

user.nameuser.email 与身份验证无关。
只有 Git 提交作者身份。

请检查git config credential.helper 输出:例如,如果osxkeychain,如Caching your GitHub password in Git,那么check the keychain as in here,对于github.com 条目:

相应地编辑或删除条目。

【讨论】:

    猜你喜欢
    • 2011-11-13
    • 2022-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多