Using GitHub for Collaborative Coding on the Cluster
How-to-Guide for connecting your GitHub account to the cluster, creating a new repository, cloning it to the cluster and collaborating on the cluster.
1. Step: Connect Github Account
Connect your Github account to the cluster (more detailed info see: https://docs.gitlab.com/ee/user/ssh.html#add-an-ssh-key-to-your-gitlab-account)
(please skip if you have used GitHub on the cluster before)
Create an SSH key on the cluster:
ssh-keygen -t ed25519 -C "<youremail@university.com>”
Navigate to the folder where it was placed (usually in “/home/user/.ssh/id_ed25519_sk.pub”) and copy the public key (e.g. “ssh-rsa AAAAB3NzaC1…= matiasrus@dunwich.sleep.ru.is”)
Place the public key on your GitHub account in the browser under your user > settings > SSH and GPC keys
2. Step: Create Repository
Set up a new GitHub repository on through the Github website (https://github.com)
3. Step: Clone the new GitHub project to the cluster
You can find this shareable link on the start page of the repository using GitHub in the browser. If you are using a private repository, you additionally need to give your fellow users access rights. For this navigate to settings > collaborators > add people and add them through their GitHub user names.
git clone git@github.com:hiluka/cluster_git.git
4. Step: Collaborate!
Before you work on the project:
git pull
After you created new code files / plots / results:
git add [changed file or * for all files]
Then save your current state:
git commit -m “info about my updates”
Then push your state to the shared repository:
git push
If you need further introduction on Git practices see https://docs.gitlab.com/ee/gitlab-basics/start-using-git.html