Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I completely delete user info from git terminal?

Tags:

git

github

I created a test git and github account a few days ago. Today I created a new github account and updated my git terminal username and email using git config --global user.name and git config --global user.email commands. But when I push a repo using git push origin master to my new github account, it still appears to use the test git username that I created before and gives me this error:

remote: Permission to github repo url denied to old username.

fatal: unable to access github repo url: The requested URL returned error: 403

I've tried deleting the old user too but nothing works. When I run git config --global --list, it shows my new details.

I've tried a lot of things before posting on here so I really don't know what the problem is. Any help would be greatly appreciated!

like image 894
Jacob Avatar asked Dec 11 '22 15:12

Jacob


2 Answers

git credential-osxkeychain erase
host=github.com
protocol=https
[Press Return]

Then you can do push, and the terminal is going to answer for new credentials.

From ikaikastine

like image 100
Pablo Cegarra Avatar answered Jan 05 '23 21:01

Pablo Cegarra


I've been struggling with an issue of this kind for 2 hours or so, and finnally picked an idea from one of the answers: it was to clean the config file. To do that, I just opened it on an editor (sudo gedit .git/config) and saved the file totally empty. After that, I filled some of the missed info like user.name, user.email. Then, I've made an git init and a git clone , and editted one of the files. When I tried to upload it with the git push origin master it prompted me to enter the credentials (Username and Password), and finally I was able to submit my changes! I hope it helps you and I'm sorry about my English, it's not my native tongue.

like image 21
Nico Sabbath Avatar answered Jan 05 '23 21:01

Nico Sabbath