1

I created a new GitHub account and did a git push --setup-upstream origin after I added my origin branch.

After deleting my old GitHub credentials under Credential Manager in Windows, it seemed to be working fine, was getting the GitHub-sign-in window from Visual Studio Code to sign in and used new account credentials.

Once I did git push to push my project upstream, my GitHub now tells me my old account had pushed the project into my new account's branch...

How is that possible? I don't have any SSH or other tokens assigned from my old account so that is the confusing part.

I also can't seem to find a solution to "log out" or get rid of my old GitHub from upstreaming this to my new account. Is there something I am missing?

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
Jason Todd
  • 181
  • 2
  • 10
  • 1
    Maybe you should check `git config user.email`. – lzhh May 21 '21 at 03:18
  • Does this answer your question? [Remove credentials from Git](https://stackoverflow.com/questions/15381198/remove-credentials-from-git) – SwissCodeMen May 21 '21 at 06:20
  • You don't log in to GitHub, so you can't log out from it (at least as far as committing goes—you do log in for using their web interface to make comments, for instance). What's not clear to me from your question is whether you're asking why you can `git push`, or why GitHub claims that the commits were by some particular user. Those are two different things as far as GitHub is concerned: GitHub takes the email address in each commit (which is just ordinary text) and uses that to say who made the commits, for instance. – torek May 21 '21 at 06:47
  • If you make commits that you claim are authored by Joe Biden or Kamala Harris, GitHub believes you. They literally *can't* check this, other than by checking any GPG signatures if you add those (and then they can only say "seems legit as far as we can tell from the GPG key", or "seems iffy from the GPG key in the commit"). – torek May 21 '21 at 06:48

1 Answers1

0

Do not mix-up what you see beside commits on GitHub with the one actually pushing those commits.

You can check which credentials (username/password) is used for pushing to GitHub with (assuming latest Git 2.30+, and git config credential-manager set to manager-core) with:

printf "protocol=https\nhost=github.com"|git credential-manager-core get

This differ from git config user.name/email, which is why I always set (since Git 2.8, March 2016)

git config --global user.useconfigonly true

That forces me to specify the right user.name/email at the first commit in each new repository.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250