How do I push to GitHub under a different username?

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

    git config user.name only changes the name I commit. I still cannot push. This is how I solved it, and I think is an easy way to me.

    1. Generate a SSH key under the user name you want to push on the computer you will use https://help.github.com/articles/connecting-to-github-with-ssh/

    2. Add this key to the github user account that you want to push to https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

    3. Choose to Clone with SSH

    You can push in as this user to that repo now.

提交回复
热议问题