Getting started with Git

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

First, you must figure out what you need.

Note: the man pages for git as well as the official documentation can be a bit confusing for a beginner. Git commands are often referred as git-command, e.g. git-add, git-commit, .... Thus you can check the man page for any command: man git-command, e.g. man git-commit, man git-add, .... However when you use those commands, the hyphen must be replaced by a space. You would do: git add myfile.txt and not git-add myfile.txt.

Simple local git repository

Case scenario: You only need to have a local repository on your own computer. You don't need to share this repository with other people.

This simple tutorial will get you started:
http://www.gitcasts.com/posts/setup-initialization-and-cloning
http://www.gitcasts.com/

https://help.ubuntu.com/community/Git

Simple commands

Here are the few commands that you will need from the very beginning:

git init: inside your new project folder, to create a local repository.
git add .:
git ls-files --cache: list the files in the current project.
git commit: commit your code using the default editor to write your message.
git status: see if there is some code to be committed or not.
git log:
git clone git://... projectname : checkout a remote git project into locale working copy.

</code>:
<code>
:

Hosting a public git repository

Case scenario: You want to share your git repository with other people over the web.

You will probably need gitosis:
http://eagain.net/gitweb/?p=gitosis.git
From the README:

Manage ``git`` repositories, provide access to them over SSH,
with tight access control and not needing shell accounts.

Tutorials of interest:
http://wiki.dreamhost.com/Gitosis for Dreamhost customers.
https://help.ubuntu.com/community/Git Ubuntu documentation.
http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secu...