What is Git?
Git is a version control system used to track changes in computer files. Git's primary purpose is to manage any changes made in one or more projects over a given period of time. It helps coordinate work among members of a project team and tracks progress over time. Git also helps both programming professionals and non-technical users by monitoring their project files.
What is Gitlab?
GitLab is a web-based Git repository that provides free open and private repositories, issue-following capabilities, and wikis. It is a complete DevOps platform that enables professionals to perform all the tasks in a project—from project planning and source code management to monitoring and security. Furthermore, it allows teams to collaborate and build better software.
Above copy from https://www.simplilearn.com/tutorials/git-tutorial/what-is-gitlab
Nowadays Gitlab has been widely used in many companies, as it's free I think...
Generally I’m accustomed to using github desktop to connect git repositories, such as github. It’s my first try to use gitlab so I searched for some information in google. Below is my summarization.
SSH communicates with Git
Open your Git Bash (if not, please install Git).
Confirm if you have an existing SSH key pair.
- Go to your home directory, and enter .ssh/ subfolder to see if you have ssh before.
- In common, ED25519 (preferred) is
id_ed25519.pub, or RSA is
id_rsa.pub, or ECDSA is
If you have neither of them, you should generate an SSH key pair, for example for ED25519:
ssh-keygen -t ed25519 -C "<comment>"
Copy the contents of your public key file by Git Bash, for example:
cat ~/.ssh/id_ed25519.pub | clip
Then Add the SSH key to your Gitlab account.
Sign in to Gitlab, and select preferences from your avatar in the top right corner.
- Select SSH keys on the left sidebar.
- Paste the keys in the Key box and then select Add key.
Verify that you can connect to the Gitlab. Open Git Bash and run this command, replacing
gitlab.example.com with your Gitlab instance URL.
ssh -T firstname.lastname@example.org
If this is your first time to connect, you may see the requirement for verifying the authenticity of Gitlab host. If not you may receive a Welcome message.
Now that the general configuration is completed, you can clone your repository as a normal Git process by SSH.
git clone email@example.com/test.git
Above all refer to https://docs.gitlab.com/ee/ssh/
RStudio connects to Gitlab by SSH
If you would like to use RStudio, you should paste your ssh key from RStudio into the Gitlab key box.
Then select RStudio File -> New Project -> Version Control -> Git.
SSH url you get from Gitlab, and paste it into Repository URL. Click on Create Project to start cloning and setting up the Rstudio environment.
Now you can use simple
push commands in RStudio as in Git.
Github desktop with Gitlab Repository by HTTP
Download Github Desktop first (if not).
Go to your Gitlab repository (specify) that you want to clone, and click the Settings -> Access Token on the left sidebar.
Add a project access token, including Name, Expires(optional) and Scopes. After filling in, click on Create Personal access Token.
Copy your access token and store it somewhere as we will use it later.
Open Github desktop, and click on file -> clone a repository. And then paste the URL of your repository into the URL field and choose the destination folder (Local path). After that select clone.
While cloning, it would pop up a window that let you enter username and password. That is your access token we created before. After that click on Save and retry to restart cloning.
Finally you can operate the repository between local and remote as we are used in Github.
Above all refer to How to use Github Desktop with Gitlab Repository
Please indicate the source: http://www.bioinfo-scrounger.com