Setup git access on TeamCity behind firewall

Problem: Our CI server needs to grab the source code from external world to run a build.

Use git behind firewall

git config –global -l
check http.proxy=?

git config -global http.proxy=http://proxy-server:port-number
If reset is necessary,
git config –global  unset http.proxy
or  git config –global unset-all http.proxy


Configure TeamCity connect to external git repository

So far there is no place to set http proxy in teamcity yet. (we are on teamcity 7.03)

One easiest solution is:

  1. git clone to local repo folder, e.g. c:/git_repo>git clone https://remote-git myrepo
  2. share this folder on local network
  3. in TeamCity, VCS settings, set remote fetch url to \\repo-host\myrepo
  4. tahdah…it works!

Remaining problem is we still need to manually run git pull on git_repo folder to get latest from remote, maybe a cron job can make this easier.