Change Git user in IntelliJ IDEA

My IntelliJ IDEA was used by another user and when I try to push to Git, I was asked a password of this user.

How can I change user in my IDEA? I tried to change global Git user, but it is not working.


  1. Go to the base directory of your project.

  2. You will find a hidden directory called ".git". Enter into it.

  3. There you will see a file called "config". Add the below code.

    [user]
          name = username
          email = [email protected]
    

You can change it global via any of the 2 options.

  1. "Git Bash" which comes with the git installation package.
  2. In IntelliJ View > Tool Windows > Terminal (Alt + F12).

Use command :

git config --global user.name "John Doe"

I found a solution myself: just find hidden .git file in your project root, open it, and change user.


Go to VCS -> Git -> Remotes

There you can edited your git remotes by changing user in the URL https://user@serc-bitbucket.

In your next Push you'll be prompted to a dialog to enter your password, and in the next your credientials.