Install, Git executable, enable VCS
Beginner IntelliJ UI
Why this matters
Two settings decide how the rest of this section feels: where Git is, and whether the staging area is switched on. The second is the bigger decision, because it chooses between IntelliJ's own way of organising work and Git's.
Finding Git
IntelliJ runs the git binary; it does not include one. Settings (⌘, on macOS, Ctrl+Alt+S elsewhere) → Version Control → Git has a Path to Git executable field with a Test button that reports the version.
If Test fails:
- Confirm Git is installed:
git --versionin a terminal. - Find its path:
which git, orwhere giton Windows. - Paste that path into the field and click Test again.
- On Windows, the usual path is
C:\Program Files\Git\bin\git.exe.
Putting a project under version control
If you opened a folder that is not a repository:
| Route | Result |
|---|---|
VCS Operations Popup (⌥) → **Enable Version Control Integration** → Git |git init` at the project root |
|
| VCS → Create Git Repository… | git init in a directory you choose, for a project with several repositories |
Afterwards, the Commit tool window shows every file under Unversioned Files, which is IntelliJ's name for untracked. Nothing is in Git until you add and commit them.
If the project is already a clone, IntelliJ detects the repository when you open the folder and the Git menu appears by itself.
The settings that matter
Settings → Version Control → Git:
| Setting | Suggested | Why |
|---|---|---|
| Enable staging area | On, if you know Git | Uses Git's real staging area instead of changelists (lesson 16.5) |
| Update method | Merge or Rebase, matching your team | Decides what Update Project does (lesson 7.5) |
| Auto-update if push was rejected | Off while learning | So a rejected push is something you see and understand |
| Warn if CRLF line separators are about to be committed | On | Catches the Windows line-ending problem early (lesson 4.5) |
Settings → Version Control → Commit holds the workflow options: whether the commit window is a tool window or a dialog, and the Before Commit checks such as reformatting and optimizing imports.
Identity
IntelliJ uses your Git configuration for the commit author, so git config --global user.name and user.email still apply (lesson 3.3). If a commit ever shows the wrong author, that is where to look, not in the IDE's settings.
How to do it
$ git --version
$ which git
$ git config --global user.emailThose three answer everything in this lesson except which options IntelliJ has switched on.
The equivalent settings are git.path, and there is no staging-area toggle because VS Code always uses Git's staging area. See lesson 15.1.
- Settings → Version Control → Git → Path to Git executable, with Test
- VCS Operations Popup (⌥`) → Enable Version Control Integration
- Settings → Version Control → Commit for the workflow options
- Find Action (⇧⌘A) → type any of the above, which survives menu changes
Nothing platform-specific: this is between the IDE and your computer.
The same.
Common mistakes
- Expecting IntelliJ to include Git. It runs the one you installed.
- Leaving Before Commit reformatting on, which adds unrelated changes to every commit.
- Turning the staging area on without knowing what it is, then finding the commit window unfamiliar.
- Adding everything at the first commit, including secrets and build output.
- Looking for the commit author in IDE settings. It comes from
git config.
Try it yourself
Goal: connect the IDE to Git and make one deliberate commit.
- Open Settings → Version Control → Git and click Test beside the Git path.
- Decide on the staging area: on if you have used
git add, off if you have not, and note which you chose. - Open Settings → Version Control → Commit and confirm no Before Commit reformatting is enabled.
- On a folder that is not yet a repository, use Enable Version Control Integration, write a
.gitignore, then add and commit the files you actually want. - Run
git log --oneline -1in the IDE's terminal to confirm the commit and its author.
Expected result: a working Git integration, a repository created from the IDE, and a first commit whose contents you chose.
Show solution
Step 2 is the decision that shapes the rest of the section. With the staging area on, the commit window behaves like git add; with it off, you get changelists, which are IntelliJ's own idea and explained in lesson 16.5. Neither is wrong; knowing which you have prevents a lot of confusion.