DEV Community

Cover image for How to push remote changes to github with another account
Akram Narejo
Akram Narejo

Posted on • Updated on

How to push remote changes to github with another account

In git when we push changes remotely to another account we always get an error like. Permission to x denied to y. here y is the old account we used to keep pushing with.

Now when we are trying to push with different account to different repository it tells us that permission denied.
And we always changes just by
git config --global user.name or user.email
but doesn't work. Because the old account is stored in a cache what we call credentials. In windows or mac we simply remove the credentials with a click of mouse that's what everybody tells and that's Ok.

But what about Linux, where do we find the credentials to remove. You can not find a file in Linux which stores the credentials. To change them we need a command.
git config --global credential.username
( it lets u know the old username u're logged in with ) and to change it just type the account username you're trying to push the changes to.
git config --global credential.username "username"
that's all later on you will be prompted to provide password.

Top comments (0)