This post is the second part (and final) about how to install Bonobo Git Server under Windows 7 over HTTPS with Windows authentication. In this post I will explain how to connect and download a project as user. As prerequisite, you need an already installed and configured Git server, see my previous post.
Create your user at the server and check permissions
- Open your web browser and type:
https://<server_ip>/Bonobo.Git.Server.Interface- As explained when installing the server, the Git server uses a self-signed certificate for secure transfer protocol (HTTPS) that can not be validated. This kind of certificates are ONLY acceptable for intranet pourposes (never for public servers). Your web browser will show an error screen about not being able to validate the identity of the SSL certificate owner (that is the Git server administrator). You must add a permanent exception to access the Git server web page.
- You will be prompted to enter your user and password. Use your windows domain user and password:
User: <your_domain>\<your_user>
Pass: <your_user_password>
- Once you are logged in for the first time, nothing will be available to your user. The reason is that you do not have any permissions, associated repositories or groups. The administrator of the Git server has to set up your account. However, this test has three objectives. First, you have checked the availability of the server to your computer. Second, this first log in has created you account. Finally, if you click on your user name (top right corner), you can edit your user information. You should take a few seconds to enter valid information: real name and surname, and your e-mail account, since this data will be used to store your credentials while pushing to repositories.
Install Git
- Download (and install) the latest version of Git at:
http://git-scm.com/download/win- Click next on every screen. If you don’t want to pollute your context menu, be sure to uncheck “Windows Explorer Integration” at the program features screen.
- If you are really brave ;), use the Git Bash console to work with the repositories. Otherwise, install a user-friendly GUI client as explained below. I usually use both, each one has its own advantages and disadvantages.
Install a Git Client with graphical user interface
There are several Git clients with GUI, see here. I recommend you to use SmartGit/Hg for non-commercial projects, because it is free, frequently updated, and plenty of features.
- Install the Java Runtime Environment 8 update 25 (or higher). You can download it from here. I recommend to install both x86 (32 bits) and x64 (64 bits) versions under a 64 bits Windows operative system.
- Download SmartGit. Choose the “Installer without JRE”, since you have already installed Java in the previous step.
Creating the folder for cloning a repository
- As explained before in step 1, the Git server uses a self-signed certificate. SmartGit or any other client will complain about not being able to validate the identity of the server. Therefore, it is mandatory to disable SSL validation for each new repository manually. A bare “git clone” command will not work.
Solution:- Create a new directory called <project_name> anywhere on your hard drive. The repository will be cloned inside.
- Create a file named “gitclone.sh”. Edit the file and copy the code at the end of of this post. Copy “gitclone.sh” to the previously created folder.
- Open Git Bash and browse to that folder (with linux-like commands ‘cd’ and ‘ls’). If you selected during the installation shell integration, right-Click on the new directory and select “Git Bash Here”.
- Once Git Bash is inside the folder, type in the terminal:
gitclone <project_name> <your_domain_user_name>
and hit enter.
- In SmartGit, open the existing local repository (Repository -> Add or Create), and click the Pull button.
- If you are able to successfully open the project an pull the repository, remove the “gitclone.sh” file, which is no longer needed.
- Always use your Windows credentials (user and password), following username scheme: DOMAIN\<username> for pulling and pushing to the server.
Resources
It is advisable to take a look at some online tutorials to grasp the surface of what can be done with Git. You may start with these ones:
- http://www.vogella.com/tutorials/Git/article.html
- http://www.vogella.com/tutorials/GitWorkflows/article.html
gitclone.sh
#!/bin/sh
function usage
{
echo -e "usage:\t\tgitclone <git_project_name> <your_windows_login_username>"
echo -e "example:\tgitclone MyProject xmellado"
exit
}
if [ $# -eq 0 ]; then
echo "Your command line does not contain arguments. Two arguments are expected."
usage
elif [ $# -eq 1 ]; then
echo "Your command line contains $# argument. Two arguments are expected."
usage
elif [ $# -gt 2 ]; then
echo "Your command line contains $# arguments. Only two arguments are expected."
usage
fi
GIT_PROJECT_NAME=$1
GIT_USER_NAME=$2
echo "Initializing empty Git repository"
git init
echo "Disabling SSL verification since the Git server uses a self-signed certificate"
git config http.sslVerify false
echo "Adding the remote server"
git remote add origin https://<your_domain>\\$GIT_USER_NAME@<server_IP>/Bonobo.Git.Server/$GIT_PROJECT_NAME.git
echo "Increasing buffer size for large transfer operations (maximum 512 MB)"
git config http.postBuffer 524288000
echo "Pulling files from remote server"
git pull origin master
echo "Set local master branch to track origin/master branch"
git branch -u origin/master