【问题标题】:How to fix git push name?如何修复 git push 名称?
【发布时间】:2015-12-18 18:39:27
【问题描述】:

当我尝试 git push 时,我看到了这条消息:

远程:PavelMetsko 拒绝 Karetski/univercube.git 的权限。 致命:无法访问“https://github.com/Karetski/univercube.git/”:请求的 URL 返回错误:403

但在 git config 我看到另一个用户名

push.default=simple
core.autocrlf=true
user.email=karetski@gmail.com
user.name=Karetski
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/Karetski/univercube.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

如何解决这个问题?我需要“Karetski”用户名而不是“PavelMetsko”

【问题讨论】:

  • .gitconfig 存储在 3 个位置。每个系统、每个用户和每个存储库。它们可以相互覆盖。你都检查了吗?
  • 我检查了 --global 配置和存储库配置。我在哪里可以找到其他的?我使用 OS X Yosemite
  • Git 不提供用户名(也不提供密码)。当使用 https 作为你的协议时,它是一个提供这些的“凭证助手”。有关详细信息,请参阅help.github.com/articles/caching-your-github-password-in-git。 (使用 ssh,git 仍然不提供用户名或密码,但使用 ssh 的设置对我来说似乎更简单。)
  • 谢谢@torek。你的回答太棒了。真的很有帮助!!!
  • 这能回答你的问题吗? How do I update the password for Git?

标签: git github


【解决方案1】:

user.name 不是用于访问控制,而是用于提交。

用户名

您的全名将记录在任何新创建的提交中。可以被 GIT_AUTHOR_NAME 和 GIT_COMMITTER_NAME 环境变量覆盖。请参阅 git-commit-tree(1)。

你需要设置的是你的credentials

[credential "https://github.com/Karetski/univercube.git"]
    username = Karetski

【讨论】:

    猜你喜欢
    • 2021-04-23
    • 1970-01-01
    • 2011-09-13
    • 1970-01-01
    • 1970-01-01
    • 2016-10-03
    • 2019-01-09
    • 1970-01-01
    • 2016-05-01
    相关资源
    最近更新 更多