Need to change username in git pull Follow
I need to run git pull with another username than what is coming up as default in the ssh popup. Can this be configured somewhere? As it is now the ssh request popup presents my username in uppercase while the repository requires the username to be in lowercase.
Please sign in to leave a comment.
check the .git/config file for the URL of the remote repository. Probably you'll see the username in the URL there, and you can change it then.
For other people that had the same problem as I and the comment above did not help; try changing git global user config:
although I was trying to change git user when pushing.
The above commands change name and email used by git as the author when you commit.
They have nothing to do with SSH connection, which was the problem in the initial request.
That is true Dmitriy. My search led me here; So I was just trying to help people that like myself, did not know git author is what they should be looking for when you want to push with another user and not trying to help the original poster.
Ran into this problem today InteliJ 2019.1. Looks like IntelliJ stores the git user name somewhere internally for the ssh git connection. I couldn't figure out where IntelliJ stores the git user name. I modified %USERPROFILE%/.gitconfig and IntelliJ would not pick up the new git user name. I deleted %USERPROFILE%/.gitconfig. Backed up my local changes using a .patch file. Backed up changes I had on shelf using a .patch file. Backed up shared runConfigurations (copied the folder from .idea). Then I deleted the project folder in its entirety. Opened IntelliJ and created the project again File -> New Project From Version Control -> Git. Provided the ssh url to the git repo and Test the connection. On my first commit I got the pop up to enter my user name and user email. After that I was good. Annotations picked up the new user name.
Can someone from the the IntelliJ team clarify where the user name and user email from the the pop up gets stored? I know it gets saved in %USERPROFILE%/.gitconfig but it is also saved somewhere else. Please provide the second location where the information is stored.
> Looks like IntelliJ stores the git user name somewhere internally
IntelliJ relies on command line git, and git user name is determined by the git config. It is not saved in the IDE.
> or the ssh git connection
git username is not related to ssh connection. Git just calls the ssh client, which connects in accordance with its own settings, %USERPROFILE%/ssh/.config by default.
> I modified %USERPROFILE%/.gitconfig and IntelliJ would not pick up the new git user name
IntelliJ does not commit by itself, it just issues the git commit command and relies on git to determine user name. So probably different username was configured in the repository config. See https://git-scm.com/docs/git-config#_configuration_file
For me this was happening when doing Git: Update Project. I don't remember when it started happening because for a while I would just update from the command line with git pull, but at some point I got a bit annoyed. Turns out it was because in my project folder I had an old git repo from a previous project, that had a different user name:
So all I had to do knowing this is to go PyCharm | Settings... and in the Version Control tab, and unregister that folder as a git root. Problem solved!