Git 配置问题和 git 推送错误

Git config issue and git push error

我在 ~/.gitconfig

下有 --global git 配置

有邮箱1

我在 git 存储库的 .git/config

下也有 --local git 配置

有邮箱2

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

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

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

我正在使用 https github url,因此没有设置或添加到 github 的 ssh 密钥。

git config --get user.email

显示 email2 当 运行 在远程仓库的克隆下。

显示 email1 当 运行 来自我的 ubuntu 主目录

git config --get-all user.email

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

显示 email1 当 运行 来自我的 ubuntu 主目录

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

git config -l