A
A
Alexander Sharomet2017-04-17 20:00:57
git
Alexander Sharomet, 2017-04-17 20:00:57

How to change user in git?

Hello.
I have two github profiles.
I've always worked under one, but now I've switched to the other.
I cloned the repository and when I try to push it, it says that I have no rights.
I tried to change the username and email via the console.
git config --global user.name "username"
git config --global user.email [email protected]
but nothing changes.
How can this be fixed? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2017-04-17
@sharomet

I cloned the repository and when I try to push it, it says that I have no rights.

If you cloned the repository for ssh access, then you need to either add the new user's authentication data on the server, or push on behalf of the old user.
For example, if the server is github, then a new user can be added here by simply adding their public key.
I tried to change the username and email via the console.
git config --global user.name "username"
git config --global user.email [email protected]

These options are used to identify the author of the commit, they are not related to authentication.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question