Creating a personal git tree: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
Line 36: Line 36:
<pre>
<pre>
cd LOCAL_PROJ_DIR
cd LOCAL_PROJ_DIR
git init
git add *
git commit -a -m 'Initial commit.'
git push --all git+ssh://USER@dev.laptop.org/~/public_git/PROJ
git push --all git+ssh://USER@dev.laptop.org/~/public_git/PROJ
</pre>
</pre>

Revision as of 00:35, 22 April 2008

Get permission to host the tree

These instructions assume that you wish to create a new personal git tree for a project named PROJ hosted in an account named USER on our hosting server, http://dev.laptop.org. See project_hosting for a directions on applying for an account. Shell access to dev.laptop.org is generally not granted without specific needs. Usually, a git tree will be created for you as part of the application for hosting a project.

The instructions below assume that you are currently logged into dev.laptop.org, using something like:

ssh USER@dev.laptop.org

Git-web expects to find bare repositories (i.e. repos with no working directory). What you probably want to do is create the bare repository in the public_git dir, and then clone that repository to a working dir somewhere else.

Option 1: Clone an existing repo

If your tree is going to be a clone of an existing repository, the easiest thing to do is this:

cd ~/public_git
git clone --bare <REPOSITORY_PATH>

If you are cloning another repository on dev.laptop.org, the repository path can be local, e.g. /git/sugar-tookit.

Option 2: Initialize an empty repo

To make a new bare, empty repository:

mkdir -p ~/public_git/PROJ
cd ~/public_git/PROJ
git --bare init

Eventually you'll want to fill in the repository. You can either push commits into the new repo, for example by running:

cd LOCAL_PROJ_DIR
git init
git add *
git commit -a -m 'Initial commit.'
git push --all git+ssh://USER@dev.laptop.org/~/public_git/PROJ

or you can pull commits into the repo, by running:

cd ~/public_git/PROJ
git --git-dir=. fetch <repo-url>

finally:

Edit the repository description: Fill in something meaningful for gitweb by putting a line in ~/public_git/PROJ/description.


Further Reading

Git