Creating a personal git tree: Difference between revisions

From OLPC
Jump to navigation Jump to search
mNo edit summary
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== 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


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.
== Initialize a new bare repo ==


The instructions below assume that you are currently logged into dev.laptop.org, using something like:
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.
== Edit the repo description ==


== Option 1: Clone an existing repo ==
Fill in something meaningful for gitweb by putting a line in ~/public_git/PROJ/description.


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


<pre>
You can either push commits into the new repo, for example by running
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.

== Option 2: Initialize an empty repo ==

To make a new bare, empty repository:


<pre>
<pre>
mkdir -p ~/public_git/PROJ
cd LOCAL_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>
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>
Line 28: Line 45:


<pre>
<pre>
ssh USER@dev.laptop.org
cd ~/public_git/PROJ
cd ~/public_git/PROJ
git --git-dir=. pull <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.


== See also ==

{{:Git/See also}}

[[Category:Software development]]
[[Category:Software]]
[[Category:Developers]]
[[Category:HowTo]]
[[Category:Git]]

Latest revision as of 04:55, 2 July 2014

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.


See also