Public Git repositories#

The git/ folder, at the root of the personal space is special. The Git repositories stored inside will automatically be published with read only access at https://git.club1.fr, for example:

https://git.club1.fr/nicolas/dna-backup//home/nicolas/git/dna-backup/

This address allows 2 things:

  1. Clone the Git repository using git clone thanks to git-http-backend.

  2. Quickly browse the sources and repository data in a web browser thanks to the Web interface cgit.

Usage tutorial#

To use CLUB1’s public Git repositories feature, a repository must first be initialized remotely, with SSH, from a personal computer (replace USER with your login and REPO with the name you want to give to the repository):

ssh USER@club1.fr git init --bare git/REPO

From now on, the repository is published with read only permissions at https://git.club1.fr/USER/REPO, but it is empty for now. The branch displayed by default in the Web interface is master. It is possible to change it by modifying the HEAD file of the repository. For instance, to replace it by the main branch:

echo 'ref: refs/heads/main' | ssh USER@club1.fr sponge git/REPO/HEAD

Similarly, to modify the repository’s description (this modification might not be instantly displayed due to cgit’s cache):

echo 'ma super description' | ssh USER@club1.fr sponge git/REPO/description

There are then two scenarios:

Creation of an new repository#

If the goal is to create a new repository, then the easiest way is to clone on your personal computer the one that has just been initialized on the server. We use the address SSH for this because it offers write access to the repository:

git clone USER@club1.fr:git/REPO

Note

A warning will indicate that the cloned repository is empty, which is normal:

warning: You appear to have cloned an empty repository.

It is now possible to use this repository as any other Git repository, for instance:

cd REPO
echo 'Hello World!' >> README
git add README
git commit -m "add Hello World README"
git push origin

Publication of an existing repository#

If the goal is to publish an existing repository, then simply add the remote repository that has just been initialized to remotes and push the desired branch there, for example with the main branch (the - -set-upstream makes it the default remote for this branch):

git remote add club1 USER@club1.fr:git/REPO
git push --set-upstream club1 main

Software#

Git#

Distributed version control system software — Wikipedia, Sources

cgit#

Web interface allowing to consult the information of a Git repository.

At CLUB1, cgit is accessible through the HTTP server Apache. — Source