I created a repo on github, set up the repo url locally, and tried to push for the first time git push origin main.
It asked my for a password, but I noticed that the prompt was using the username of my other github account. I ran a few git commands to change my credentials so that I can successfully push and be authenticated.
Im still not able to authenticate, with a password, but i figure i get this git situation fixed first because I feel like i dug myself into a hole by firing desperation shots.
first i changed my username
git config --global credential.username "MyUserName"
git config --global credentials.username "MyUserName"
then I ran
git config --global credential.helper manager
then
git config --global alias.credential-manager "credential-manager-core"
and now I'm getting a message that says
expansion of alias 'credential-manager' failed; 'credential-manager-core' is not a git command git: 'credential-manager-core' is not a git command. See 'git --help'.
when I try to push.
I also deleted my github info from Keychain on macOS.
Your Git client username and email are both stored in the text file ".gitconfig" in your local user home directory.
On Windows this would be (for example) C:\Users\Bob\.gitconfig
Instead of running the above commands, you can just edit this file directly with your favorite text editor.
It should contain something like this (replace with your own data):
If you wish to push existing code to a new (empty) repository on GitHub, they describe in details how to do it.
Hopefully this will help you. :-)