【问题标题】:Git config issue and git push errorGit 配置问题和 git push 错误
【发布时间】:2017-07-29 17:35:48
【问题描述】:

我在~/.gitconfig下有--global git config

有电子邮件1

我在 git repo 的 .git/config 下也有 --local git config

有email2

两者都有不同的电子邮件。

现在,当我从具有 --local 配置的 repo 克隆下推送到远程 repo 时,我收到一条错误消息 "remote: Permission to abc/def.git denied to email1." em>

为什么会这样,我该如何解决这个问题?

我使用的是 https github url,所以没有设置或添加到 github 的 ssh 密钥。

git config --get user.email

在远程 repo 的克隆下运行时显示 email2

从我的 ubuntu 主目录运行时显示 email1

git config --get-all user.email

在远程仓库的克隆下运行时同时显示 email1email2

从我的 ubuntu 主目录运行时显示 email1

【问题讨论】:

  • git config --get user.email 显示哪个电子邮件? git config --get-all user.email呢?
  • @llion Post 更新了您的问题的答案。
  • git config --get github.user 是否显示任何内容?你知道你是否有一个凭证助手设置吗?哎呀,也许只是做git config -l,看看会发生什么。
  • 是的,你是对的。在我使凭证助手缓存无效后,事情开始正常工作。我只是自己弄清楚了这一点。如果您根据您的评论做出回答,我会接受。谢谢

标签: git github git-push git-config


【解决方案1】:

您的凭据助手中可能存储了凭据。您应该尝试使它们无效。您还可以使用以下命令查看所有当前配置设置:

git config -l

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-19
    • 2011-04-29
    • 2013-03-24
    • 1970-01-01
    • 1970-01-01
    • 2014-12-02
    • 1970-01-01
    • 2023-03-07
    相关资源
    最近更新 更多