How do I push to GitHub under a different username?

后端 未结 20 1998
盖世英雄少女心
盖世英雄少女心 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:30

    If you use different windows user, your SSH key and git settings will be independent.

    If this is not an option for you, then your friend should add your SSH key to her Github account.

    Although, previous solution will keep you pushing as yourself, but it will allow you to push into her repo. If you don't want this and work in different folder on the same pc, you can setup username and email locally inside a folder with git by removing -g flag of the config command:

    git config user.name her_username
    git config user.email her_email
    

    Alternatively, if you push over https protocol, Github will prompt for username/password every time (unless you use a password manager).

提交回复
热议问题