How do I push to GitHub under a different username?

后端 未结 20 1994
盖世英雄少女心
盖世英雄少女心 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条回答
  •  遥遥无期
    2020-12-02 04:33

    You can push with using different account. For example, if your account is A which is stored in .gitconfig and you want to use account B which is the owner of the repo you want to push.

    Account B: B_user_name, B_password
    Example of SSH link: https://github.com/B_user_name/project.git

    The push with B account is:

    $ git push https://'B_user_name':'B_password'@github.com/B_user_name/project.git
    

    To see the account in .gitconfig

    1. $git config --global --list
    2. $git config --global -e (to change account also)

提交回复
热议问题