In order to host your versioned code on GitLab, you need to have an existing remote project, already created on GitLab. This project is generally an empty project, with a certain name.
- Connect to your GitLab account
- Select
New project, thenCreate blank project - Give a name to it (ex:
my-first-project-with-git)
Note: The name you'll give can be different from the one you give to your local project but it is a good practice to have it the same locally and remotely.
- Select the
Privatevisibility level, to make this project only visible by you - Uncheck the configuration
Initialize repository with a README; you already have a README in your local project - Click on
Create project
Now both projects are initialized, remote one on GitLab, local one in Git, we need to configure the local Git project to target a specific GitLab project to be able to save/import (i.e. push/pull) code to/from GitLab.
- On GitLab, click on the blue
codemenu and copy the URL given by theClone with HTTPSoption.
- In your local projet, under the
practicalfolder, open a Git terminal - Write down the following command :
git remote add originand paste the URL. This command adds to the local project a link to a remote project in the origin channel, given by the URL
Note : For Windows users, ctrl v doesn't work properly on the git terminal. You need to do a right-click -> paste to paste the URL
- Check that the remote project was correctly added :
git remote -v
The push action on Git sends all the commits newer than the last one set on GitLab to the GitLab project.
In the two previous section, we've created an empty project on GitLab and have linked it to the local project.
Let's now push the files to gitlab
- Under the
practicalfolder, open a Git terminal - Write down the following command :
git push origin main. - Refresh your GitLab project ; you should now see your files and the different commits.
Note : It may happen that GitLab asks you some credentials to be able to push/pull/clone a project. This is a security feature to link your GitLab account to your computer. Under your account, select
Edit profileand click onAccess tokens. Create a new token, with the following settings
- Expiration date : at least 6 months later
- Read-repository option
- Write repository option
Once created, copy it and paste it in the
tokenfield, and add your gaspar username under theusernamefield.
- Project title
- Permission level
- Number of commits / branches / tags
- Project size
- Last commit
- History of commits
- File edition
- Cloning & downloaded options
- Current branch / commit you are looking at
- Project files & hierarchy
- Automatic preview of the README file
- Open issues
- Create merge request
- Manage permissions on your project, adding collaborators
- Deploy your code publicly with releases
- Make some advanced configuration on your project
The main file edition which is done directly on GitLab is an update of the README file. The main reason for that is that you would like to have the most comprehensible and beautiful documentation and you need for that to see the final preview, which is only available on GitLab.
- Click on the README file to open it
- Under the
Editblue menu, selectEdit single file
- Enrich the README by adding the link to download Fiji
If you don't have Fiji instaleld, please download it from [this website](https://imagej.net/software/fiji/)
- Click on
Commit changes
The pull action on Git gets all the commits newer than the last one set locally from the GitLab project.
In the previous section, we've added a new commit on GitLab, which is not added locally yet.
- Under the
practicalfolder, open a Git terminal - Write down the following command :
git pull origin main. - Open the README.md file ; you should see the modifications you've done on GitLab.