How to change your git repo’s remote from redmine git to GitLab

How to change your git repo’s remote from redmine git to GitLab

Due to technical reasons, ACDH has to switch from its self-hosted git repositories (which were so far integrated into our project management platform redmine) to external hosting on GitLab.

As a consequence, all contributors to a project will have to point their local git repository copy to a new server address (git remote) to synchronize with. Here we describe how this is done.

1 Register at GitLab

In order to sync your local repository with others, you need a user account on GitLab. Going to https://gitlab.com/users/sign_in you can either create a new gitlab account or log in with your existing GitHub, Google, Twitter or Bitbucket credentials.

2 Becoming part of the team

Announce your GitLab username to your main contact at ACDH or to acdh-tech@oeaw.ac.at, naming the git repository you want to contribute to. Our admins will then grant the necessary rights to you and tell you the new address of the repository.

3 Update the remote address of the git repository

Option 1: Using Tortoise Git

  1. find the git repository’s local folder on your PC
  2. right click on it
  3. in the „TortoiseGit“ context menu select „settings“
  4. open the menu entry „Git -> Remote“ on the left hand side of the settings dialog
  5. select „Remotes -> origin“
  6. Change the URL of the remote from https://{user}@redmine.acdh.oeaw.ac.at/{repositoryname}.git to the repository’s new address (usually this will be https://gitlab.com/acdh-oeaw/{projectname}/{repositoryname}.git)
  7. Save the settings by clicking „Add New / Save“ and „OK“ – from now on you will be pulling from / pushing towards the repository on GitLab.

Option 2: Using git from the command line

  1. cd to the git repository’s local directory
  2. using your favourite text editor, open the config file in the (hidden).git subdirectory
  3. find the line „url“ in the settings block „[remote "origin"]“ and exchange the value by the new address
  4. save the config file – from now on you will be pulling from / pushing towards the repository on GitLab.

Notes on authentication

Empty GitLab password with an external account (e.g. Google)

This is only relevant if you use GitLab with an external account.

When you are accessing GitLab with an external account (GitHub, Google, Twitter or Bitbucket), your GitLab account will not have a password in the first place. For this reason, GitLab will prevent you from interacting with the repository (pushing, pulling etc.) until you have manually set a password. To do this, go to https://gitlab.com/profile/password/edit, enter your password and save it. Afterwards you will be prompted to log in again, this time using your newly set password. From now on, you should be able to pull or push from your git client (e.g. TortoiseGit) throught https.

SSH

Because the previous redmine setup allowed only https communication with the repository, per default you will be provided with a https URL for your new remote with username + password authentication. However, GitLab also offers the possibility to pull and push via ssh. If you want to make use of this, you have to add your public ssh key in the settings of your GitLab account and update the remote address to git@gitlab.com:acdh-oeaw/{projectname}/{repositoryname}.git.


export blog text