git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
pinkman
V2EX  ›  git

一台机器上两个不同 git user push 到 github 遇到问题

  •  
  •   pinkman · Apr 14, 2015 · 3951 views
    This topic created in 4151 days ago, the information mentioned may be changed or developed.
    本机之前有个git (global) 用户,由于需要新建了个github账户,在本机新生成了id_rsa (与之前的文件不同名) 将新的id_rsa.pub添加到了新的github账户,又在本地创建了新的repo,设置了针对该repo的用户和邮箱地址 git config user.name 新用户 git config user.email 新用户。

    貌似一切都操作正确了,但push新repo的时候遇到了remote: Permission to repo.git denied to 老用户. 的报错,我又跑去git config --global user.name 新用户 git config --global user.email 新用户,push依旧报错,麻烦帮忙看看到底哪里没有做对呢?
    3 replies    2015-04-14 23:52:49 +08:00
    jokester
        1
    jokester  
       Apr 14, 2015
    你推的时候要指定对应的私钥 (id_rsa 之类)

    另外那个user只是影响新commit的署名 和push基本没关系
    ChiangDi
        2
    ChiangDi  
       Apr 14, 2015 via Android
    再在新电脑上生成 ssh key,再加到 github 设置里的 ssh key 里,github 支持你添加多个 ssh key 的。
    GG668v26Fd55CP5W
        3
    GG668v26Fd55CP5W  
       Apr 14, 2015 via iPhone
    可能是system 或者local级的git config覆盖了global级的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3692 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 00:43 · PVG 08:43 · LAX 17:43 · JFK 20:43
    ♥ Do have faith in what you're doing.