Git Hosting: Difference between revisions

From CSCWiki
Jump to navigation Jump to search
(Add instructions for filesystem pushing)
Line 3: Line 3:
== Usage ==
== Usage ==
It's basically GitHub
It's basically GitHub

== Pushing and pulling from the filesystem ==
(for syscom only)
<br>
If you need to keep the ability to push/pull from the filesystem, in addition to Gitea, you will need to make sure that the repo directory is owned by a group in which you are a member, and is group-writable.
For example, let's say we want to make sure that everyone in the syscom group can push to the a repo called 'keyring'.
The way we're doing this right now is kind of hacky, but it works::
<ol>
<li>Change the name of the repo folder, e.g. <code>mv /srv/git/keyring.git /srv/git/keyring.git.bak</code></li>
<li>Create a new repo with the name `keyring` from the Gitea web UI. This should create a bare repository at <code>/srv/git/keyring</code>.</li>
<li>
Clone the keyring.git.bak repo to somewhere else (e.g. your homedir), add the Gitea URL as another remote, and push to the Gitea remote. e.g.
<pre>
cd ~
git clone /srv/git/keyring.git.bak
cd keyring.git.bak
git remote add gitea https://git.csclub.uwaterloo.ca/public/keyring.git
git push gitea master
</pre>
If there are any other branches, push them as well.
</li>
<li>
Remove the new repo directory and replace it with the old one:
<pre>
rm -rf /srv/git/keyring.git
mv /srv/git/keyring.git.bak /srv/git/keyring.git
</pre>
</li>
<li>
Change file permissions if necessary:
<pre>
chown -R git:syscom /srv/git/keyring.git
chmod g+s /srv/git/keyring.git
</pre>
You will need to do this from phosphoric-acid (due to NFS root squashing).
</li>
</ol>
After the steps above, you *should* be able to push to the keyring repo in three ways: Gitea via HTTPS, Gitea via SSH, and via the raw filesystem (i.e. <code>git clone /srv/git/keyring.git</code>). Furthermore, everyone in syscom should be able to push to it via the filesystem.

Revision as of 22:45, 20 June 2021

We have a gitea instance running off of caffeine. You can sign in via LDAP to the web interface. Projects used by CSC as a whole are owned by the public organization.

Usage

It's basically GitHub

Pushing and pulling from the filesystem

(for syscom only)
If you need to keep the ability to push/pull from the filesystem, in addition to Gitea, you will need to make sure that the repo directory is owned by a group in which you are a member, and is group-writable. For example, let's say we want to make sure that everyone in the syscom group can push to the a repo called 'keyring'. The way we're doing this right now is kind of hacky, but it works::

  1. Change the name of the repo folder, e.g. mv /srv/git/keyring.git /srv/git/keyring.git.bak
  2. Create a new repo with the name `keyring` from the Gitea web UI. This should create a bare repository at /srv/git/keyring.
  3. Clone the keyring.git.bak repo to somewhere else (e.g. your homedir), add the Gitea URL as another remote, and push to the Gitea remote. e.g.
    cd ~
    git clone /srv/git/keyring.git.bak
    cd keyring.git.bak
    git remote add gitea https://git.csclub.uwaterloo.ca/public/keyring.git
    git push gitea master
    

    If there are any other branches, push them as well.

  4. Remove the new repo directory and replace it with the old one:
    rm -rf /srv/git/keyring.git
    mv /srv/git/keyring.git.bak /srv/git/keyring.git
    
  5. Change file permissions if necessary:
    chown -R git:syscom /srv/git/keyring.git
    chmod g+s /srv/git/keyring.git
    

    You will need to do this from phosphoric-acid (due to NFS root squashing).

After the steps above, you *should* be able to push to the keyring repo in three ways: Gitea via HTTPS, Gitea via SSH, and via the raw filesystem (i.e. git clone /srv/git/keyring.git). Furthermore, everyone in syscom should be able to push to it via the filesystem.