git pushes with wrong user from terminal

前端 未结 22 1460
夕颜
夕颜 2020-12-07 07:51

I have an issue with git and my terminal.

Here\'s a gallery to show you my issue : http://imgur.com/a/6RrEY

When I push commits from my terminal, git says I

22条回答
  •  借酒劲吻你
    2020-12-07 08:08

    Just spent 6 hours figuring this out when trying to push to a new GitHub pages repo on a new account.

    Even after setting the config user.name and user.email it would default to my main account.

    This is because the ssh key will default to id_rsa (my main account).

    To use the new account I had to run:

    ssh-add ~/.ssh/my_new_key

    which will then make git use the new key when pushing.

提交回复
热议问题