How do I push to GitHub under a different username?

后端 未结 20 2038
盖世英雄少女心
盖世英雄少女心 2020-12-02 04:00

A friend and myself are sharing my computer. I\'ve made pushes to GitHub using the git bash shell on Windows 7. Now we\'re in a different project on that computer and I need

20条回答
  •  旧时难觅i
    2020-12-02 04:39

    If after running git push Git asks for a password of user, but you would like to push as new_user, you may want to use git config remote.origin.url:

    $ git push
    user@my.host.com:either/branch/or/path's password:
    

    At this point use ^C to quit git push and use following to push as new_user.

    $ git config remote.origin.url
    user@my.host.com:either/branch/or/path
    
    $ git config remote.origin.url new_user@my.host.com:either/branch/or/path
    
    $ git push
    new_user@my.host.com:either/branch/or/path's password:
    

提交回复
热议问题