How do I log in using the Git terminal?

Solution 1:

user.name & user.email have nothing to do with the server communication - they are used only when committing. If you use HTTP to access your repo, then add another remote with your new username in the URL:

git remote add origin2 https://[email protected]/repo

And then push/fetch using the new remote:

git push origin2 branch_name

Windows will recognize that the URL has new username and will ask for your creds.

You can also use SSH. Generate the key, upload the public one to your Git Server under the right account, set up .ssh/config to use that key. Though you still will need either to add new remote or re-point the existing one to switch to SSH protocol.

Git Credential Manager

Another option (as stated here) that's available since 2018 is to git credential-manager reject <url>. Though personally I didn't test it.

Solution 2:

Just entering your user in the command line won't work for newer versions of git. To sign in, you'll need to download git CLI, then do gh auth login