github我是谁? (OSX)
github who am I? (OSX)
我认为我是 github USER_A,但是 github 认为我是 USER_B。首先,我检查一下我是谁:
$ git config --list
color.ui=auto
push.default=simple
user.name=USER_A
user.email=USER_A@gmail.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/USER_A/MY_REPO.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
然后,我 git 克隆我的存储库:
$ git clone https://github.com/USER_A/MY_REPO.git
Cloning into 'MY_REPO'...
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 9 (delta 0), reused 0 (delta 0), pack-reused 6
Unpacking objects: 100% (9/9), done.
Checking connectivity... done.
然后我更改一些东西,提交并推送:
$ git push
remote: Permission to USER_A/MY_REPO.git denied to USER_B.
fatal: unable to access 'https://github.com/USER_A/MY_REPO.git/': The requested URL returned error: 403
This 关于此错误的唯一 Github 说明。
Why does git/github think I'm pushing as USER_B?!
编辑:根据评论,我 运行 这个测试:
$ ssh -T git@github.com
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of
known hosts.
Hi **USER_A**! You've successfully authenticated, but GitHub does not provide
shell access.
我没有 ~/.ssh/config 或 /etc/ssh/ssh_config 文件。我在 Mac FWIW。
我发现了问题,我的 Mac 钥匙串有 USER_B。我在 Keychain 应用程序中搜索 "github" 时找到了它。我更新了问题以反映这是一个 Mac-specific problem/solution.
我遇到了同样的问题。我能够使用以下命令找出 git 使用的密钥:
ssh -v -T git@github.com
然后,我看到 github 正在使用另一个密钥;所以,我将我的默认密钥添加到 SSH 代理:
ssh-add ~/.ssh/id_rsa
那么,问题就解决了:-)
如果您遇到问题,我会做以下几件事:
运行
Vics-iMac:ansible vic$ git config --list
说明:当您第一次配置 git 时,通常会在设置阶段完成很多事情。其中之一是配置你是谁,以及你使用的电子邮件地址。如果您检查上面命令的以下输出。您将看到正在使用 user.name。
user.name = BlahBlah Name
user.email = blahadklhf@gmail.com
我认为我是 github USER_A,但是 github 认为我是 USER_B。首先,我检查一下我是谁:
$ git config --list
color.ui=auto
push.default=simple
user.name=USER_A
user.email=USER_A@gmail.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/USER_A/MY_REPO.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
然后,我 git 克隆我的存储库:
$ git clone https://github.com/USER_A/MY_REPO.git
Cloning into 'MY_REPO'...
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 9 (delta 0), reused 0 (delta 0), pack-reused 6
Unpacking objects: 100% (9/9), done.
Checking connectivity... done.
然后我更改一些东西,提交并推送:
$ git push
remote: Permission to USER_A/MY_REPO.git denied to USER_B.
fatal: unable to access 'https://github.com/USER_A/MY_REPO.git/': The requested URL returned error: 403
This 关于此错误的唯一 Github 说明。
Why does git/github think I'm pushing as USER_B?!
编辑:根据评论,我 运行 这个测试:
$ ssh -T git@github.com
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of
known hosts.
Hi **USER_A**! You've successfully authenticated, but GitHub does not provide
shell access.
我没有 ~/.ssh/config 或 /etc/ssh/ssh_config 文件。我在 Mac FWIW。
我发现了问题,我的 Mac 钥匙串有 USER_B。我在 Keychain 应用程序中搜索 "github" 时找到了它。我更新了问题以反映这是一个 Mac-specific problem/solution.
我遇到了同样的问题。我能够使用以下命令找出 git 使用的密钥:
ssh -v -T git@github.com
然后,我看到 github 正在使用另一个密钥;所以,我将我的默认密钥添加到 SSH 代理:
ssh-add ~/.ssh/id_rsa
那么,问题就解决了:-)
如果您遇到问题,我会做以下几件事:
运行
Vics-iMac:ansible vic$ git config --list
说明:当您第一次配置 git 时,通常会在设置阶段完成很多事情。其中之一是配置你是谁,以及你使用的电子邮件地址。如果您检查上面命令的以下输出。您将看到正在使用 user.name。
user.name = BlahBlah Name
user.email = blahadklhf@gmail.com