windows: git has old github username, cant change git user

unable to access 'https://github.com/new/test.git/':

That means: SSH is not involved. At all.
And user.name / user.email has nothing to do with authentication either.

Since you are using https, Git will use the first cached credential it finds for github.com.
Check the returned value of git config credential.helper
On windows, for instance, that would be the Windows credential manager.

You should at least specify the new GitHub account in your URL:

cd /path/to/your/local/repo
git remote set-url origin https://<newGitHubAccount>@github.com/newGitHubAccount/test.git

Then a Git push should trigger a popup asking you for your new GitHub account password.

If you want, you also can switch back to SSH.
You can manage multiple SSH keys as I describe here.


You can specify the username to use for authentication separately from the Git author name using credential.user. You can either set this globally (git config --global credential.user mylogin) or just for a single repository. That would sort it out for https authentication variation. Github with HTTPS does allow you to push. To debug issues there, run the git command under GIT_CURL_VERBOSE=1 to see the web headers. eg: GIT_CURL_VERBOSE=1 git ls-remote https://github.com/username/repo.git. If you enabled 2-factor authentication then you can't use your normal password, but must use a key you fetch from the website.

Note that puttygen can import an SSH RSA key-pair and convert it to a PPK key file and also do the reverse so you can convert keys from openssh to putty.

If you configure to use SSH keys then the key is used for your identity. You can run the git command under GIT_TRACE=1 to see what it is actually running. If it is putty/plink then you need to check the putty session information stored in the registry and see what key has been associated with the github session you are using. If openssh then the key should be in $HOME/.ssh/id_rsa and you can check which user key you have there.

Tags:

Git