代码之家  ›  专栏  ›  技术社区  ›  showkey

如何写.netrc为两个帐户跳过键入密码时git push?

  •  1
  • showkey  · 技术社区  · 6 年前

    执行时跳过输入密码很简单 git psuh 命令。

    vim  .netrc
    machine github.com
    login user1
    password  pass-user1
    

    如何写.netrc为两个帐户跳过键入密码时git push?

    按如下方式编写.netrc是没有用的。

    vim  .netrc
    machine github.com
    login user1
    password  pass-user1
    login user2
    password  pass-user2
    

    根据VONC编辑.netrc,如下所示。

    machine github.com login user1 password  pass-user1
    machine github.com login user2 password  pass-user2 
    

    Git Push的奇怪错误。

    git push -u origin master -f
    remote: Permission to user2/test.git denied to user1.
    fatal: unable to access 'https://github.com/user2/test/': The requested URL returned error: 403
    
    git remote -v
    origin  https://github.com/user2/test (fetch)
    origin  https://github.com/user2/test (push)
    
    2 回复  |  直到 6 年前
        1
  •  2
  •   VonC    6 年前


    machine github.com login user1 password  pass-user1
    machine github.com login user2 password  pass-user2
    

    origin

    git remote set-up origin https://user2@github.com/user2/arepo.git
    

    git remote add origin https://user2@github.com/user2/arepo.git
    
        2
  •  0
  •   showkey    6 年前

    machine github.com login user1 password  pass-user1
    machine github.com login user2 password  pass-user2
    

    git remote add origin   https://user2@github.com/user2/arepo.git
    

    git remote set-up origin https://user2@github.com/user2/arepo.git