Git Hosting: Difference between revisions

From CSCWiki
Jump to navigation Jump to search
Line 5: Line 5:


- raymo
- raymo

=== SSH keys ===
It is recommended to setup [https://git.csclub.uwaterloo.ca/user/settings/keys SSH keys] so that you do not have to enter your password each time you push to a repo. Once you have uploaded your public key, add the following to your ~/.ssh/config:
<pre>
Host csclub.uwaterloo.ca
HostName csclub.uwaterloo.ca
IdentityFile ~/.ssh/id_rsa
User git
</pre>
(Replace ~/.ssh/id_rsa by the location of your private SSH key.) Now you should be able to clone, push and pull over SSH.


== Pushing and pulling from the filesystem ==
== Pushing and pulling from the filesystem ==

Revision as of 13:25, 4 July 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"

- raymo

SSH keys

It is recommended to setup SSH keys so that you do not have to enter your password each time you push to a repo. Once you have uploaded your public key, add the following to your ~/.ssh/config:

Host csclub.uwaterloo.ca
        HostName csclub.uwaterloo.ca
        IdentityFile ~/.ssh/id_rsa
        User git

(Replace ~/.ssh/id_rsa by the location of your private SSH key.) Now you should be able to clone, push and pull over SSH.

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 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.git.
  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
    
  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+w /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.