Issue
I have a WSL Ubuntu 20.04 system where my username is firstnamelastname. On the server for our git repository however, my name is firstname.lastname.
This appears to confuse git a lot. Every time I try to pull, it keeps trying to do so as firstnamelastname, not the correct account with the period between the names.
What I have tried so far:
- Re-generating my SSH keys with
-C firstname.lastname
, thenssh-copy-id
'ing them to the server - Setting my username with
git config --global user.name firstname.lastname
.
Neither of these have worked.
How do I fix this?
Solution
The -C
just adds a comment to the key, it doesn't change or set a username.
Since you're using an SSH key I'm assuming you're using git over ssh. You should check to see what your remote is for the repository, as the username is normally embedded in the remote URL.
For example, on github the remote would look like [email protected]:my_account/my_repo.git
. Note the username is set to git here, which is what github requires. You can set a remote to use any url and username you want.
Run git remote -v
to see your remotes. Then run git remote set-url REMOTE_NAME NEW_URL
to change the remote and your username.
Answered By - Robert Hafner Answer Checked By - David Goodson (WPSolving Volunteer)