I
I
ince2020-01-30 17:59:53
git
ince, 2020-01-30 17:59:53

How to change git account?

It seems that the situation should be common, but I did not find the answer.

There are two repositories on github.
One of them is locally registered in git.
When I do git pushit in another repository, then it naturally gives me an error 403.
I tried to change the username like this

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

but this only affects commit signatures, not access.
How can I fix this?
I do push via https

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
SagePtr, 2020-01-30
@SagePtr

If under Windows - Then through the Control Panel -> Credential Manager

J
jcmvbkbc, 2020-01-30
@jcmvbkbc

Oh, it would be nice to switch accounts between each other somehow

You can generate a personal access token (on github -- user settings -> developer settings -> personal access tokens -> generate new token) for another account and add a remote for the repository to which you want to push from another account with authentication using this token. For example:
git remote add user_a_at_b https://user_a:[email protected]/b/b.git

will add remote user_a_at_b, through which you can push to the b/b.git repository on behalf of the user user_a.

Y
youngtitanium, 2020-09-21
@youngtitanium

It is forbidden.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question