Very often you will have more than one git user per project or technology. Having control over the default and project git user in PyCharm/IntelliJ is one of the first setups that you will need to do in order to have consistent git commits and pushes.

in this post:

  • Change git user for IntelliJ/PyCharm project
  • Change global git user
  • Additional settings

Change git user for IntelliJ/PyCharm project

Changing the user only for one specific project:

  • Open your project in IntelliJ/PyCharm
  • Select a file from the project
    • right click and Show in Files
  • Locate the root project folder ( you can do it directly if you know it)
  • Show hidden files ( in case that they are not visible )
  • Search for folder .git and enter
  • Find file: config and edit
  • Add this section at the bottom

[user]
name = myuser
email = [email protected]

Now all commits and pushes will be done for this user from this project.

Note: if you don't have an user in your git config file then the global settings will be used.

If you are using github the you can go to:

  • File
  • Settings
  • Version Control
  • GitHub
  • Change token with password
  • Enter your username and password
  • Apply and OK

Change global git user

If you want to change your default git user you can do it by simple command like:

git config --global user.name "myuser" user.email "[email protected]"

Check the information for the global git user:

git config user.name
git config user.email
git config --global user.name

result:

 myuser
 [email protected]
 myuser

Additonal settings

The additional settings for git in IntelliJ/PyCharam are available here:

  • File
  • Settings
  • Version Control
  • GitHub

Here you can change the host (to BitBucket) or to use a token instead of a password.

If you want to change your remote then you can:

  • Menu
  • VCS
  • Git
  • Remotes