Cloning the Qt git repository into a corporate environment

Let's assume you work inside a bigger company and want to clone the Qt git repository (or any other), there is a firewall and internet access via proxy only. Nothing out of the ordinary here and let's further assume that your company uses Windows workstations.

First thing needed is Git for Windows. Download. Install.

On Windows you get the Git Bash, a Unix like shell. Fire that up. You should end (or start) in you user directory. Set a Git property to use your proxy and clone the repository via HTTPS:

$ git config --global http.proxy YOURCOMPANYPROXYNAME:PROXYPORT
$ git clone https://git.gitorious.org/qt/qt5.git

Now learn that the perl version inside Git Bash is outdated:

$ cd qt5
$ ./init-repository -help
"GetOptionsFromArray" is not exported by the Getopt::Long module
Can't continue after import errors at ./init-repository line 203
BEGIN failed--compilation aborted at ./init-repository line 203.

Download Active Perl, install it.

Use this perl version and learn that you have no certificates installed (the -f is used to force the initialization of the repository, because the last try has left some information on disk).

$ /c/Perl64/bin/perl ./init-repository -f --http
# cut most lines
+ git fetch https://git.gitorious.org/qt/qtactiveqt.git
fatal: unable to access 'https://git.gitorious.org/qt/qtactiveqt.git/': SSL certificate problem: unable to get local issuer certificate

Be lazy, ignore security and fetch anyway:

$ env GIT_SSL_NO_VERIFY=true /c/Perl64/bin/perl ./init-repository -f --http

There you go.

You want some more...

If you also want to contribute and push your changes to Gerrit, you need some more:

Configure your Gerrit account, see Log in with your public JIRA credentials. Start the Git Bash.

$ mkdir .ssh
$ cd .ssh
$ vi config

add the information for the Qt repository:

Host codereview.qt-project.org
ProxyCommand ncat --proxy YOURCOMPANYPROXYNAME:PROXYPORT  --proxy-type http %h %p
ServerAliveInterval 10
HostName ssh.qt-project.org
Port 443
User YOURGERRITUSERNAME

Replace the uppercase entries with the values for your account and the company's proxy.

On Unix systems you would probably see a nc command to connect via proxy. This is not part of windows and does (sadly) not come with the Git Bash. There is an alternative: Donwload ncat for Windows, install it and add the installation directory to your PATH environment variable. While you're on your way, nmap is worth beeing added to your toolchain, too.

Cloning should be now possible via ssh:

$ git clone ssh://YOURGERRITUSERNAME@codereview.qt-project.org/qt/qtbase.git

So, you're able to tunnel the ssh connection, the rest should work just fine.