Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get git to work through a proxy and IntelliJ Idea?

Where do I configure the proxy settings for GIT in IntelliJ Idea? I've gotten the proxy settings working for the plugins, but I just can't find it for GIT; and the help files only mention subversion.

Any help is appreciated.

like image 488
maximus Avatar asked Aug 24 '10 14:08

maximus


People also ask

How do I Git behind a proxy?

Setting the proxy for Git Run the following commands replacing USERNAME , PASSWORD , PROXY_ADDRESS , and PROXY_PORT with your network's information: git config --global --add http. proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT. git config --global --add https.

How does IntelliJ integrate with Git?

Associate the entire project with a single Git repository Alternatively, from the main menu, select VCS | Enable Version Control Integration. Choose Git as the version control system and click OK. After VCS integration is enabled, IntelliJ IDEA will ask you whether you want to share project settings files via VCS.

Where are proxy settings in IntelliJ?

Configure proxy settings directly from IntelliJ IDEA. Do the following: Open the Version Control | Subversion | Network page of the IDE settings Ctrl+Alt+S . Click the Edit Network Options button and specify the proxy settings in the Edit Subversion Options Related to Network Layers dialog that opens.

How does IntelliJ push to GitHub?

Do one of the following: To push changes from the current branch press Ctrl+Shift+K or choose Git | Push from the main menu. To push changes from any local branch that has a remote, select this branch in the Branches popup and choose Push from the list of actions.


2 Answers

You have to configure proxy for git and not for intelliJ, intelliJ will just call the git command line.

git config --global http.proxy yourProxy:port should do it.

like image 50
Colin Hebert Avatar answered Nov 03 '22 18:11

Colin Hebert


To be complete I would like to add how to hop over a proxy to get to git server or secured sites using ssh, like for example private github repositories.

For intellij when using this option, you must select to use the native ssh implementation in Project Settings --> Version Control --> VCSs --> Git --> SSH Executable

We use a tool called corkscrew. This is available for both CygWin (through setup from the cygwin homepage) and Linux using your favorite packaging tool.

For MacOSX I refer to this blogpost to install it on you Mac.

The command line is as follows :

corkscrew <proxyhost> <proxyport> <targethost> <targetport> <authfile>

The proxyhost and proxyport are the coordinates of the https proxy.

The targethost and targetport is the location of the host to tunnel to.

The authfile is a textfile with 1 line containing your proxy server username/password separated by a colon

e.g:

abc:very_secret

Installation for using git:// protocol : usually not needed!

  • Create a helper script to create the tunnel

Create a script ~/bin/gitproxy which contains :

#!/bin/bash
corkscrew proxy.colo.elex.be 3128 github.com 9148 ~/.ssh/proxy_auth 
  • Create the proxy_auth file in the ~/.ssh/ folder

Make sure it is safe from prying eyes.

  • Set an environment variable to define the proxy command for git

    $ export GIT_PROXY_COMMAND=/home/pti/bin/gitproxy

You might place this in a section or script sourced from .bashrc which dynamically detects if you are behind the proxy or not. If the variable is not defined then git will work as usual.

  • test it

Installation for using "normal" ssh protocol for git communication By adding this to the ~/.ssh/config this trick can be used for normal ssh connections

Host gitproxy HostName github.com Port 22 ProxyCommand corkscrew %h %p ~/.ssh/proxy_auth

enjoy!

like image 31
Peter Tillemans Avatar answered Nov 03 '22 19:11

Peter Tillemans