Git Hosting: Difference between revisions

From CSCWiki
Jump to navigation Jump to search
(Add instructions for filesystem pushing)
Line 9: Line 9:
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.
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'.
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::
The way we're doing this right now is kind of hacky, but it works:
<ol>
<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>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>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>
<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.
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.
Line 30: Line 30:
mv /srv/git/keyring.git.bak /srv/git/keyring.git
mv /srv/git/keyring.git.bak /srv/git/keyring.git
</pre>
</pre>
(It appears that it is necessary to push to Gitea at least once for later changes to show up.)
</li>
</li>
<li>
<li>

Revision as of 22:47, 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
    

    (It appears that it is necessary to push to Gitea at least once for later changes to show up.)

  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.