User Guide - Git


Applicable Plans: All CentOS 5 eApps General VPS Plans 

User Guide - Git 

Git is a free & open source distributed version control system, designed to handle everything from small to very large projects with speed and efficiency.
http://www.git-scm.org

Overview

This User Guide is designed to get you started with Git on your eApps hosting plan. If you need more information than what is provided in this User Guide, you will want to reference the official Git documentation which is located here - http://git-scm.com/documentation There are also links to Git Tutorials at the end of this User Guide, in the Links to other information section.

Git is only available on plans using the CentOS 5 or greater operating system. To see what operating system (OS) you have, click on the Subscriptions icon from the My Account tab of your Control Panel. Then click on the name of the subscription you want to see. The OS for the subscription will be displayed near the top of the page. If you are not on a CentOS 5 plan, but would like information on updating your plan, please contact eApps Technical Support for more information.

Warning This User Guide is limited to the installation of Git and Gitweb from the Control Panel on your eApps Hosting service, and is not intended as a Git tutorial. If you need assistance installing or configuring Git or Gitweb on your eApps Hosting service, please contact eApps Support. If you need assistance coming up to speed with Git, or if you have questions on how to use Git, please consult the official documentation or one of the many tutorials available online. See the Links to other information section for examples. 

Installing Git

Creating a Project
Creating a project with Git
Checkout Source Code via SSH
Import Source Code via SSH

Enabling and Securing Gitweb

Gitweb username and password

Git clients

Links to other information


Installing Git

Login to your Control Panel, and click on the System Tab. If necessary, click the Select Another System (Subscription) link on the left and choose the correct Virtuozzo container.

If you are not sure if Git is installed, go to Applications, and click on All Applications. If you see Git in the list, then the application is installed, and you can skip the next steps. If you do not see Git in the list, please continue with the next steps.

Go to Applications, and click on the Add Application link. Select the box next to Git, and then scroll down and click the Next button.

This takes you back to the All Applications screen. Wait for five minutes, then click on the Refresh link at the upper right, just under the word Parallels. The application should now show as installed. If it is still in a Scheduled state, wait another five minutes, and click Refresh again. If you see it in Error state, or it still shows as Scheduled, please contact eApps Technical Support.


Creating a Project

The Git installation creates a projects directory in /opt/git. We have configured the Gitweb interface to use this location, so you should create your project in this location if you want it to be accessible by Gitweb. Gitweb is covered in the next section.

These examples are given as a quick example of how to use Git. If you need more information on how to use Git, please consult the official documentation or one of the many online tutorials available. See the Links to other information section for examples.

Creating a project with Git

Note All of the following must be done from the command line of the VPS while logged in via SSH, as the root user. See the SSH User Guide for more information if necessary.

[root@example]# cd /opt/git
[root@example git]# mkdir projectname
[root@example git]# cd projectname
[root@example projectname]# git init
[root@example projectname]# Initialized empty Git repository in /opt/git/projectname/.git/


You can now copy or move your files to your project directory. Once the files are in the project directory, then they can be added to Git.

[root@example projectname]# git add . (the dot is part of the command – this adds the files to git)
[root@example projectname]# git commit -m “initial commit”

Check out Source Code via SSH

git clone ssh://user@example.com/opt/git/projectname

Import Source Code via SSH

git push ssh://user@example.com/opt/git/projectname


Enabling and Securing Gitweb

Your Git installation also comes with a Web interface called Gitweb. It has been deployed so that you can configure it on a per site basis. To do this you will need to add some Apache directives to the Custom Settings of the site.

Login to your Control Panel, and click on the Site Tab. If necessary, click the Select Another Site link on the left and choose the correct site. Then click on Website Settings, and then the Custom Settings tab.  

Click on Edit, and add the two lines below, and then click Update to save your changes.

ScriptAlias /gitweb /var/www/cgi-bin/git
Alias /git /var/www/git

You can now view your Git projects at http://example.com/gitweb/gitweb.cgi

Gitweb username and password

To find the default user name and password for Gitweb, click back on the System Tab of the Control Panel, and go to All Applications, and click on Git. The Gitweb username and Gitweb password are at the bottom of the screen.

To change the git admin password, you must connect to the VPS via SSH, and as the root user use the htpasswd command. You can also add users and change their passwords in this manner.

[root@example ~]# htpasswd -m /var/www/.git.pwd user_name
New password: passwd
Re-type new password: passwd
Updating password for user user_name

Substitute the user you wish to change (such as admin) for user_name, and give the new password for that user. This will update the Git password file.


Git Clients

There are a large number of Git clients and front end programs, many of which can be found here – http://git.or.cz/gitwiki/InterfacesFrontendsAndTools.

These clients are also available, and are some of the more common clients:

http://kerneltrap.org/Linux/Git_on_Windows
http://kylecordes.com/2008/04/30/git-windows-go/
http://wiki.github.com/pieter/gitx

Note Due to the large number of available Git clients, it is not possible for eApps to offer support for anything other than the built-in Gitweb program. 

Because Git is a fairly new program, more clients are being written all the time. A quick Google search will find them, and possibly newer versions of the client you are already using.


Links to other information

Git Documentation - http://git.or.cz/gitwiki/GitDocumentation
Git Quickstart (very useful) - http://git.or.cz/gitwiki/QuickStart
Git Wikipedia entry - http://en.wikipedia.org/wiki/Git_(software)
Subversion to Git tutorial - http://git.or.cz/course/svn.html
The official kernel.org Git tutorial - http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
The Git Book - http://book.git-scm.com/
Git Cheat Sheet - http://git.or.cz/gitwiki/GitCheatSheet
Git Cheat Sheet, extended edition - http://jan-krueger.net/development/git-cheat-sheet-extended-edition
The Git Parable, an introduction to the concepts behind Git - http://tom.preston-werner.com/2009/05/19/the-git-parable.html

Comments

Please login to comment