From Fedora Project Wiki
(Add description of how to setup cloning via http://)
(Add whitespace and enhance the content a bit)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
== ''BETA'' git hosting support ==
= fedorapeople.org git hosting support =


fedorapeople.org now has support for hosting git repositories including accessing them via the git:// protocol for anonymous downloads as well as providing gitweb.  This should be considered beta.
fedorapeople.org now has support for hosting git repositories including accessing them via the git:// protocol for anonymous downloads as well as providing gitweb.  ''This should be considered beta.''


==== Create a <code>public_git</code> directory in your home directory on fedorapeople.org ====
=== Create a <code>~/public_git</code> directory on fedorapeople.org ===


<pre>ssh your_fedora_username@fedorapeople.org "mkdir ~/public_git"</pre>
<pre>ssh your_fedora_username@fedorapeople.org "mkdir ~/public_git"</pre>


==== Put your git repository in <code>~/public_git</code> ====


{{admon/important|The repository directory name must end with .git|Gitweb will not list repos that do not end in .git.|}}
=== Put your git repository in <code>~/public_git</code> ===


For example, here is how to create a repository on your local system and upload it:
As an example, here is one method to create an empty repository on your local system and upload it:


<pre>
<pre>
Line 22: Line 21:
</pre>
</pre>


{{admon/important|Repository access|Without git-daemon-export-ok, your repository won't be available to anyone via the git:// protocol.}}
This creates a ''bare'' repository (i.e. a repository that has no working directory).  It contains just the files that are part of the <code>.git</code> directory of a ''non-bare'' git repository (the kind most users are accustomed to seeing).


{{admon/note|Repository description|You can set the description for the repository that is displayed in gitweb by editing the description file in your repository.}}


{{admon/note|Non-bare repositories|While non-bare repositories will work, they are generally discouraged for use as remote repositories. But if you use a non-bare repository, you should place the git-daemon-export-ok file in the toplevel git dir, e.g. ~/public_git/your_repo.git/git-daemon-export-ok}}
{{admon/important|Repository name must end with .git|Gitweb will not list repos that do not end in <code>.git</code>.|}}


==== Pushing to your repository ====
{{admon/important|Repository access and git-daemon-export-ok|Without the <code>git-daemon-export-ok</code> file, your repository won't be available anonymously via the git:// protocol.}}


At this point your new repository is still empty.  You can push to it from a local repository with a little setup:
{{admon/caution|Non-bare repositories|While non-bare repositories ''should'' work, it is [http://git.or.cz/gitwiki/GitFaq#git-push%20non-bare generally discouraged] to push to such repositories.  However, if you do use a non-bare repository, you should place the git-daemon-export-ok file in the top-level git dir, e.g. <code>~/public_git/your_repo.git/git-daemon-export-ok</code>, '''NOT''' <code>~/public_git/your_repo.git/.git/git-daemon-export-ok</code>}}
 
 
=== Pushing to your repository ===
 
At this point your new repository is still empty.  To push changes from a local repository:


<pre>
<pre>
Line 38: Line 41:
</pre>
</pre>


{{admon/note|Allowing others to push|You can allow other fedorapeople.org users to push to your repository using extended acls (see "man setfacl" for details).  However, if you have many others working on your project, using [http://fedorahosted.org Fedora Hosted] is strongly preferred.}}
This creates a mirror of your local repository.  All of the branches and tags in the local repository will be pushed to the fedorapeople repository.
 
 
If you only want to push selected branches, amend the <code>git push</code> example.  For example, to push only your local master branch:
 
<pre>git push fedorapeople master</pre>
 
 
{{admon/tip|Allowing others to push|You can allow other fedorapeople.org users to push to your repository using extended acls (see <code>setfacl(1)</code> for details).  However, if you have many others working on your project, using [http://fedorahosted.org Fedora Hosted] is strongly preferred.}}
 


==== Cloning your repository ====
=== Cloning your repository ===


To clone your repository, use a command similar to:
To clone your repository, use a command similar to:
<code>git clone git://fedorapeople.org/~your_fedora_username/repo.git</code>


It is also possible to clone your project via http://.  In order for this to work, you must arrange to have git-update-server-info run whenever you update your repository.  Typically, this is done with the post-update hook script.  However, the user home directories on fedorapeople.org are mounted with the noexec option, which prevents the script from running.  Instead, you may create a symbolic link to git-update-server-info in the hooks directory of your repository:
<pre>git clone git://fedorapeople.org/~your_fedora_username/repo.git</pre>
 
 
It is also possible to clone your project via the http:// protocol.  In order for this to work, you must arrange to have <code>git-update-server-info</code> run whenever you update your repository.  Typically, this is done with a post-update hook script.  However, the user home directories on fedorapeople.org are mounted with the noexec option, which prevents the script from running.  Instead, you may create a symbolic link to <code>git-update-server-info</code> in the hooks directory of your repository:


<pre>
<pre>
Line 52: Line 66:
ln -svbf /usr/bin/git-update-server-info post-update
ln -svbf /usr/bin/git-update-server-info post-update
</pre>
</pre>


You can clone your repository over http:// with a command similar to:
You can clone your repository over http:// with a command similar to:
<code>git clone http://your_fedora_username.fedorapeople.org/git/repo.git/


==== Browse your project via gitweb ====
<pre>git clone http://your_fedora_username.fedorapeople.org/git/repo.git/</pre>
 
 
{{admon/tip|git:// versus http://|Only clone via http:// if you are behind a firewall that prevents git:// from working.  The git:// protocol is faster and more efficient than the http:// protocol for git usage.}}
 
 
=== Browse your project via gitweb ===


You can see your project listed in [http://fedorapeople.org/gitweb gitweb] once the project list updates (hourly).  ''Note that this URL may change.''
You can see your project listed in [http://fedorapeople.org/gitweb gitweb] once the project list updates (hourly).  ''Note that this URL may change.''
{{admon/tip|Repository description|You can set the description for the repository that is displayed in gitweb by editing the description file in your repository.}}

Latest revision as of 23:30, 6 October 2008

fedorapeople.org git hosting support

fedorapeople.org now has support for hosting git repositories including accessing them via the git:// protocol for anonymous downloads as well as providing gitweb. This should be considered beta.

Create a ~/public_git directory on fedorapeople.org

ssh your_fedora_username@fedorapeople.org "mkdir ~/public_git"


Put your git repository in ~/public_git

As an example, here is one method to create an empty repository on your local system and upload it:

mkdir repo.git
cd repo.git
git init --bare
touch git-daemon-export-ok
cd ..
scp -r repo.git your_fedora_username@fedorapeople.org:public_git/

This creates a bare repository (i.e. a repository that has no working directory). It contains just the files that are part of the .git directory of a non-bare git repository (the kind most users are accustomed to seeing).


Important.png
Repository name must end with .git
Gitweb will not list repos that do not end in .git.
Important.png
Repository access and git-daemon-export-ok
Without the git-daemon-export-ok file, your repository won't be available anonymously via the git:// protocol.
Stop (medium size).png
Non-bare repositories
While non-bare repositories should work, it is generally discouraged to push to such repositories. However, if you do use a non-bare repository, you should place the git-daemon-export-ok file in the top-level git dir, e.g. ~/public_git/your_repo.git/git-daemon-export-ok, NOT ~/public_git/your_repo.git/.git/git-daemon-export-ok


Pushing to your repository

At this point your new repository is still empty. To push changes from a local repository:

cd /path/to/local/repo
git remote add fedorapeople your_fedora_username@fedorapeople.org:public_git/repo.git
git push --mirror fedorapeople

This creates a mirror of your local repository. All of the branches and tags in the local repository will be pushed to the fedorapeople repository.


If you only want to push selected branches, amend the git push example. For example, to push only your local master branch:

git push fedorapeople master


Idea.png
Allowing others to push
You can allow other fedorapeople.org users to push to your repository using extended acls (see setfacl(1) for details). However, if you have many others working on your project, using Fedora Hosted is strongly preferred.


Cloning your repository

To clone your repository, use a command similar to:

git clone git://fedorapeople.org/~your_fedora_username/repo.git


It is also possible to clone your project via the http:// protocol. In order for this to work, you must arrange to have git-update-server-info run whenever you update your repository. Typically, this is done with a post-update hook script. However, the user home directories on fedorapeople.org are mounted with the noexec option, which prevents the script from running. Instead, you may create a symbolic link to git-update-server-info in the hooks directory of your repository:

ssh ~your_fedora_username@fedorapeople.org
cd ~/public_git/repo.git/hooks
ln -svbf /usr/bin/git-update-server-info post-update


You can clone your repository over http:// with a command similar to:

git clone http://your_fedora_username.fedorapeople.org/git/repo.git/


Idea.png
git:// versus http://
Only clone via http:// if you are behind a firewall that prevents git:// from working. The git:// protocol is faster and more efficient than the http:// protocol for git usage.


Browse your project via gitweb

You can see your project listed in gitweb once the project list updates (hourly). Note that this URL may change.


Idea.png
Repository description
You can set the description for the repository that is displayed in gitweb by editing the description file in your repository.