In this post:

  • Version control and IntelliJ IDEA 18
  • setup git for windows
    • portable
    • installation
  • install git for linux
  • Setup proxy and Git
  • error: intellij cannot run program git
  • Reference

Version control and IntelliJ IDEA 18

In Intellij the git configurations are located in:

  • File
  • Settings - CTRL+ALT+S
  • Version Control
  • Git
  • Path to Git excetuable

All version control operations like:

  • commit
  • pull
  • push
  • remote

are located in main menu - VCS

For example checking for remotes - linked projects with git can be found:

  • VCS
  • Git
  • Remotes

You can change, delete or add you remotes from the openned dialog.

If you work with Version Control you will want to show tool bar Version control by:

  • ALT+9
  • or from menu:
    • View
    • Tool Windows
    • Version Control

setup git for windows

Using portable git

If you want to use portable git for Windows and Intellij IDEA then you can download: Git Portable

It is a portable version of Git for Windows.

You can installed it by:

  1. Download the GitPortable directory from the link above
  2. Download PortableGit-*.7z.exe from the Git for Windows repository - for example - PortableGit-2.17.0-64-bit.7z.exe
  3. extract PortableGit-2.17.0-64-bit.7z.exe to the GitPortable\App\Git directory.
  4. Setup the path in Intellij

Add:

C:\your_path\PortableGit\cmd\git.exe

to Intellij - Path to Git excetuable

Install git for windows

  1. Download the Git for Windows installer from: Git for Windows
  2. Started the installer
  3. Git Setup wizard screen
  4. Follow the instructions(if you are new you can use the default options).
  5. Open a Command Prompt / Git Bash
  6. Configure git username and mail by
git config --global user.name "My name"
git config --global user.email "[email protected]"

replace "My name" and "[email protected]" with your values which will be associated as git account values.

install git for linux

Adding git to Ubuntu and Linux Mint is really easy just by a single command:

sudo apt install git

Default installation on Ubuntu 18.04 and Linux Mint 18 is:

/usr/bin/git

Setup proxy and Git

Setup by command

The easiest ay too add proxy to your git configuration is by:

git config --global http.proxy http://proxyuser:[email protected]:8080
  • proxyuser - proxy user ( you can check the proxy configuration Windows 10 - Settings/Network & Internet/Proxy or ubuntu - System/Preferences/Network Proxy)
  • proxypwd - proxy password
  • proxy.server.com - proxy server
  • 8080 - proxy port

Disable git proxy by

git config --global --unset http.proxy

Enable:

git config --global --get http.proxy

Setup by file

If the command line is not your favorite way of working, you can just edit .gitconfig

  • For Windows - check %userprofile% variable - the root of your profile - open it by: notepad %userprofile%.gitconfig in command prompt.
  • For Linux /home/user - you can access it by:
    • bash sudo nano ~/.gitconfig

and add this line:

[http]
proxy = http://proxyuser:[email protected]:8080

Cannot run program "git.exe": CreateProcess error=2, The system cannot find the file specified

If you get error:

Cannot run program "git.exe"

It means that Intellij Cannot find the git program on your machine or the path which is setup is wrong. In this case you can:

  • verify that your machine has working git - run git command in your terminal
git --version

with expected result: git version 2.7.4

  • check the path in your intellij:
  • Settings - CTRL+ALT+S
  • Version Control
  • Git
  • Path to Git executable

In case of Ubuntu you will see:

Auto-detected: /usr/bin/git

Reference