Andrei Fierbinteanu
Andrei Fierbinteanu

Reputation: 7826

IntelliJ IDEA with Git remember author

I'm using IntelliJ with a Git project, and have setup my user.name and user.email properly. The problem is when committing using the IDE interface the author is not selected by default. I can click and I get a dropdown to select it, but sometimes I forget to do that, and it's a pain to ammend the commit each time I forget.

Is there a way to set the author automatically on commit, since it's only one, and it would save me some headaches?

Upvotes: 76

Views: 86879

Answers (3)

Raj Kanchan
Raj Kanchan

Reputation: 618

Open the Terminal and execute one of the following commands:

To set a name for every Git repository on your machine, use $ git config --global user.name "John Smith"

To set a name for a single repository, use $ git config user.name "John Smith"

Go to JetBrains Git Page

This will change the upcoming changes you submit on GitHub but won't change the username which you have committed earlier.

Snapshot of IntelliJ

Upvotes: 1

CrazyCoder
CrazyCoder

Reputation: 401975

IntelliJ IDEA doesn't pre-select author in the combobox which is a known cosmetic issue, however it should use the author defined in the git configuration by default.

Please double check that user.name and user.email is specified properly in the global git configuration.

Some users mentioned a problem when using cygwin git, when IDEA probably cannot find the global git config. In this case it may help if you specify the user for the local project configuration:

git config --local user.name "John Doe"
git config --local user.email [email protected]

Upvotes: 121

Du-Lacoste
Du-Lacoste

Reputation: 12767

Go to your project where git is initialized.

Then enable the hidden folders and find ".git" and go inside the folder.

Find the file called "config" and add below code and save.

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

Enter your correct username and email accordingly. This will be picked permanently and you do not need to change again.

Upvotes: 21

Related Questions