Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
GIT_SETUP.md 5.55 KiB
Newer Older
---
adapted-from: https://app.clickup.com/2189764/v/dc/22ue4-596/22ue4-358
---

# Access GitLab

1\. Environment requirements
============================

  

You will be using the following programs the jeodpp provides:
*   Bash.
*   PyCharm.
*   Compass the GUI for MongoDB (soon to be available).

2\. Configure authentication
============================

2.1 Access Tokens
-----------------

  

Create a new access token:

  

*   Log into Gitlab [https://gitlab.jrc.nl/](https://gitlab.jrc.nl/)and click your Profile -> Settings -> Access Tokens

![](https://t2189764.p.clickup-attachments.com/t2189764/934070d9-de92-4f6a-bc29-c979f7cc7909/image.png)

*   Create a new access token:
    *   Choose a self-explanatory name, eg <you-username>@<your-PC-name>
    *   tick `read_repository` and `write_repository` scopes
    *   click `Create personal access token` button
*   Copy the token into your clipboard - it will be only visible until you close/refresh the page; afterwards you would have to re-create it.
*   Try to clone:

```plain
git clone https://jeodpp.jrc.ec.europa.eu/apps/gitlab/use_cases/legent/uds-scripts.git
```

OR add a new remote into your _existing_ local git-repo and then try to fetch:


2.2. SSH keys
-------------

SSH keys are (probably?) needed if you access gitlab through `git://...` url-schemes.

  

**Steps**

  

1.  Generate SSH key

Gitlab [https://gitlab.jrc.nl/](https://gitlab.jrc.nl/) ->Profile -> Settings -> Add SSH Key

  

![](https://t2189764.p.clickup-attachments.com/t2189764/35cc5eb8-1514-4331-8b34-e594a2e8220f/image.png)

  

Open Command line E:\\vecto\\clone\\vecto>ssh-keygen -t rsa -b 2048 -C "mail"

Copy id\_rsa.pub to the keys from Gitlab settings (.ssh/id\_rsa.pub)

  

Alternative, use Access Token. Generate token and copy. The clone will use https instead of ssh.

  

2\. Go to Gitlab petten Vecto Project

  

![](https://t2189764.p.clickup-attachments.com/t2189764/eae70443-3232-4fb9-8072-54fb6bf928a1/image.png)

  

  

2\. Fork the project into a personal repo
=========================================

  

For the git workflow selected by the team, each developer works on an independent fork of the project visible to all the team members. ([Forking workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow#:~:text=Forking%20is%20a%20git%20clone,org%2FuserA%2Fopen%2Dproject))

To create this fork click on the fork button at the top of the project page:

  

![](https://t2189764.p.clickup-attachments.com/t2189764/38c1a98c-9470-43f3-917c-7e0e1e89d702/image.png)

_Note:_ As a new team member of the team you might encounter an issue indicating that the limit of forks for this project has been reached:

![](https://t2189764.p.clickup-attachments.com/t2189764/0b406e7c-ab34-4f6c-9ccf-0be1d6160c49/image.png)

In that case contact the system administrator and ask them to change the project limit for your account.

  

After adding the name information for the fork, it is necessary to give permissions to the rest of the team to make it visible for them. For this, go to the url:

  

[https://gitlab.jrc.nl/YOURUSERNAME/vecto/-/project\_members](https://gitlab.jrc.nl/munozme/vecto/-/project_members)

  

There select the tab _Invite group_ and add VECTO.

  

![](https://t2189764.p.clickup-attachments.com/t2189764/c54c2430-63b3-47ef-b237-e31f12212e6d/image.png)

  

3\. Clone the repo
==================

  

In case you don't have a local repo open the command line and type the following command, make sure to change the url path to include your username:

  

![](https://t2189764.p.clickup-attachments.com/t2189764/a4091950-bb6b-4bf9-a83f-a0335d793928/image.png)

  

In case you already have a local repo (for example, from github) you need to add a new remote and fetch it:

  

`git remote add {username} https://jeodpp.jrc.ec.europa.eu/apps/gitlab/{username}/uds-scripts`
`git fetch {username}`

  

4\. Configure your notification email
=====================================

  

The primary email assigned to your account is your EU email. This email is used for authentication and notifications. To view your gitlab notifications you need to login to your email and check the new notifications, which means you won't be able to see as soon as you get them unless you're logged into your EU account.

An alternative to see your notifications as soon as they arrive is changing your notification email to another email account.

To do this first access [https://gitlab.jrc.nl/-/profile/emails](https://gitlab.jrc.nl/-/profile/emails) and add a secondary email address to your account. You'll receive an email from gitlab asking you to verify your account. Then go to [https://gitlab.jrc.nl/-/profile/notifications](https://gitlab.jrc.nl/-/profile/notifications) and select the email address you just added as a notification address.

  

5\. Rename your remote
======================

  

The default name for a remote is origin, and given that we work all in forks of the same project but can also make changes to someone else's fork, we decided to rename the each remote. The new name corresponds to an identifier of the server and of the username of choice as long as is brief. It looks like "ptuser". The idea is to facilitate differentiating to which remote a change is being pushed and to be able to replicate a command to an specific remote without having to change the command. To rename use the command:

  

```plain
git remote rename origin ptuser
```

  

pro-tip: for _remoting_ commands, you may use directly the _url-of-a-repo_ in place of a _remote-name, eg:_

  

```plain
git push https://github.com/some/repo.git some-branch