Jack
Jack

Reputation: 23

Github push returned a strange username

When I want to push, I use git push and it gives me the following:

remote: Permission to fjhjc01/heihei.git denied to diana4sb.
fatal: unable to access 'https://github.com/fjhjc01/heihei.git/': The requested URL returned error: 403

And I don't know who diana4sb is. I used git config -l to check the user name. It was me, fjhjc01.

I am totally confused right now. How to get rid of this diana4sb, how to change it back to me.

Upvotes: 2

Views: 105

Answers (1)

nickie
nickie

Reputation: 5808

There's two places where git stores user information.

  1. Your $HOME/.gitconfig file. You can see the configuration contained in there by executing the following command:

    git config -l --global
    
  2. A .git/config file, under each of your repositories. You can see the configuration contained there by executing the following command from inside your working repository:

    git config -l
    

In each of these files, user information is under the [user] tag.

I assume that in one of these two, there's a diana4sb. How she got there is uncertain. It could be that you're both using the same computer in the lab, or that you copied her working repository to your computer and then tried to push.


Second thought. It seems that you are using an https:// URL, not a git:// URL. In this case, the GitHub documentation says that

When you git fetch, git pull, or git push to the remote repository using HTTPS, you'll be asked for your GitHub username and password.

Depending on the OS and helper programs that you use, it may be the case that when this was done, diana4sb entered her user name and password, which were stored and are automatically reused now.

Upvotes: 1

Related Questions