0

There are many posts that cover this. However, all of them are relating to push with a different name/changed name.

I've uninstalled credentials and installed it again. And, ever since whenever I try to pull from my repository, it asks me to enter the username and password.

I wanted to set up my username and email, so I did it using

git config --global user.name "name"
git config --global user.email

And when I checked using

git --list

I saw the correct name and email.

The problem is it still asks me for my username and password whenever I pull from my own GitHub account and throw error GH007 whenever I try to push.

I've followed Your push would publish a private email address error and the primary email address seems to be correct.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
chaikov
  • 495
  • 4
  • 18
  • The `git --list` is not a valid command. I guess you meant `git config --list`. – sns Dec 22 '20 at 10:24

1 Answers1

1

Some of this is a duplicate of Error "Your push would publish a private email address" so see that for the GH007 error.

Note that GitHub's Git is complaining that some existing commits—commits that are new to them, but already exist in your own Git repository—contain email addresses that they would publish if they accepted them.

Meanwhile, there are several things to know here. Git has a very sharp distinction between what goes into commits, and how you authenticate yourself to some other Git installation. In fact, authentication isn't done by Git itself at all, but rather by third-party software: ssh, curl / libcurl, macOS keychains, Windows credentials, and so on.

When you set user.name and user.email, these control only future commits. No existing commits are changed—in fact, no existing commit can ever be changed; if you make one you don't like, you end up making a new and improved one to avoid using it, using that instead of the bad one. The git commit command builds a new commit, and when it does, it uses user.name as the name, and user.email as the email address. That's basically all they do.

In order to connect your Git installation to another Git installation, so as to transfer commits (send your new ones to them, or get new ones from them), you must authenticate yourself, so that the other Git installation knows that you are you, not someone else. This authentication never uses your user.name and user.email settings. What it does use depends on your host operating system and what protocol you use to connect to the other Git installation. If you use an https:// URL, see what the Git installation for your operating system does in order to present a user name and password. If you use an ssh:// URL, your Git installation will use whatever method your computer provides for Secure Shell to provide a key. See https://www.ssh.com/ssh/key/ for a general background.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
torek
  • 448,244
  • 59
  • 642
  • 775