如何将更改作为其他用户推送到github存储库?
我在github上以natereed的名义进行了git回购(nate@natereed.com) 我在本地克隆了repo,并发出以下命令来配置用于推送更改的标识:如何将更改作为其他用户推送到github存储库?,git,github,Git,Github,我在github上以natereed的名义进行了git回购(nate@natereed.com) 我在本地克隆了repo,并发出以下命令来配置用于推送更改的标识: git config user.name "natereed" git config user.email "nate@natereed.com" 我试图推到原点,但得到403(未经授权): 它似乎仍在使用不同的标识(reedndbn)。我如何强制它(git/ssh)使用我在上面配置并用于克隆repo的用户名(“natereed”)
git config user.name "natereed"
git config user.email "nate@natereed.com"
我试图推到原点,但得到403(未经授权):
它似乎仍在使用不同的标识(reedndbn)。我如何强制它(git/ssh)使用我在上面配置并用于克隆repo的用户名(“natereed”)
这是我的.git/config:
USAU9900:ExData_Plotting1 reedn$ more .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/natereed/ExData_Plotting1
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
name = natereed
email = nate@natereed.com
在.git/config中,您有以下内容:
[remote "origin"]
url = https://github.com/natereed/ExData_Plotting1
fetch = +refs/heads/*:refs/remotes/origin/*
因此,您使用https协议克隆了它,并且显然已经使用reedndbn为https建立了github关联。当我通过https连接到github时,系统会提示我输入用户和密码
所以更改url=https://github.com/natereed/ExData_Plotting1
到
https://natereed@github.com/natreeed/ExData\u Plotting1.git
。或者,如果为natereed设置了github ssh密钥关联,则可以使用git@github.com:natereed/ExData\u Plotting1.git
或者(我想有些人会说更好的方法)是使用git remote set url命令来改变这一点。请参阅。首先在git中添加SHH密钥并为您的系统创建权限
$ssh keygen-t rsa-C
$cat~/.ssh/id\u rsa.pub
在git中粘贴键添加shh。
然后
'git config--global user.name“user\u name”
'git config--global user.email“email\u ID”
我不想将更改提交为ReedNb。拥有回购协议的帐户是用户“natereed”。奇怪的是,这也是my.git/config中的帐户。这应该可以工作,但没有…谢谢你添加了完整的配置。在远程源下,您使用的是https,而不是ssh。因此,将其更改为:git@github.com:natereed/ExData\u Plotting1.git On在“克隆”部分下是获取ssh url的位置。您能解释一下为什么对远程源使用ssh而不是https吗?它确实使错误消失了,但我不明白为什么。
[remote "origin"]
url = https://github.com/natereed/ExData_Plotting1
fetch = +refs/heads/*:refs/remotes/origin/*