【发布时间】:2017-11-03 14:00:09
【问题描述】:
当您将本地更改推送到 GitHub 时,在终端上,git 会在推送时为您提供以下错误:
remote: Permission to someorg/somerepo.git denied to someuser.
...someuser 是从哪里读取或派生的?哪个配置文件?
【问题讨论】:
标签: git github git-config
当您将本地更改推送到 GitHub 时,在终端上,git 会在推送时为您提供以下错误:
remote: Permission to someorg/somerepo.git denied to someuser.
...someuser 是从哪里读取或派生的?哪个配置文件?
【问题讨论】:
标签: git github git-config
someuser是从哪里读取或派生的?哪个配置文件?
当您为push 连接到 GitHub 时,您必须对自己进行身份验证。 There are several ways to do that 并且您没有显示您使用的是哪一个。 (请注意,与 GitHub 的其他连接也可能需要身份验证,具体取决于存储库是否公开。)
如果您通过https:// 进行身份验证,Git 将使用各种凭据助手,这些助手可以存储用户名和/或密码。 You can configure which credential helper to use, including the "cache" and "store" helpers, which use different additional data. 注意the available set of credential helpers varies based on your underlying operating system as well.
如果您通过ssh:// 进行身份验证,则始终要求 GitHub 使用用户名git@github.com,而实际用户 ID 由 GitHub 根据您提供的 ssh 密钥确定。每个键都有一个(单个)用户与之关联。
[编辑添加] 使用git remote show origin 显示origin 的获取和推送 URL:
$ git remote show origin
* remote origin
Fetch URL: git@github.com:path/to/repo.git
Push URL: git@github.com:path/to/repo.git
如果 URL 以 git@github.com: 或 ssh://git@github.com/ 开头,则您使用的是 ssh。如果 URL 以 https://github.com/ 开头,则您使用的是 https。
有关更多基础知识和链接,请参阅GitHub setup help page。
【讨论】:
git push --set-upstream origin name-of-my-feature-branch,所以我不确定我是通过HTTPS 还是SSH 推送,我怎么知道?我可以说我是通过 HTTP(git clone https://... 等)克隆的,如果有帮助的话。再次感谢!
someuser,Git/GitHub 在哪里查找该信息?换句话说,为什么我的错误是“remote: Permission to someorg/somerepo.git denied to someuser.”而不是“remote: Permission to someorg/somerepo.git denied to some-other-user”?再次感谢!
credential.helper 命令可以采用多个值(cache、@ 987654343@ 等),但我没有看到将其重置为默认值的示例(每次都会提示您进行身份验证)。有什么想法吗?