Creating a personal git tree: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Get permission to host the tree ==
== 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.
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:
== Initialize a new bare repo ==

Git-web expects to find bare repositories (i.e. repos with no working directory). To make a new bare repo:


<pre>
<pre>
ssh USER@dev.laptop.org
ssh USER@dev.laptop.org
mkdir -p ~/public_git/PROJ
cd ~/public_git/PROJ
git --bare init
</pre>
</pre>


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 ==
As you may notice, this requires shell access to dev.laptop.org, which 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.


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


<pre>
Fill in something meaningful for gitweb by putting a line in ~/public_git/PROJ/description.
cd ~/public_git
git clone --bare <REPOSITORY_PATH>
</pre>


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


== Option 2: Initialize an empty repo ==
You can either push commits into the new repo, for example by running

To make a new bare, empty repository:

<pre>
mkdir -p ~/public_git/PROJ
cd ~/public_git/PROJ
git --bare init
</pre>

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


<pre>
<pre>
cd LOCAL_PROJ_DIR
cd LOCAL_PROJ
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>
Line 33: Line 42:


<pre>
<pre>
ssh USER@dev.laptop.org
cd ~/public_git/PROJ
cd ~/public_git/PROJ
git --git-dir=. fetch <repo-url>
git --git-dir=. fetch <repo-url>
</pre>
</pre>

== finally: ==

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



== Further Reading ==
== Further Reading ==

Revision as of 20:44, 10 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 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