Page author: @tallenet
Link SSH key gitlab eclipse
Requirement
If this is your first time contributing to an Eclipse Foundation project, you'll need to create an account on dev.eclipse.org and sign the Eclipse Contributor Agreement. Refer to Contributing.
Procedure
In order to push from your devolloping environnement to gitlab eclipse you need to authenticate to your eclipse gitlab account. The fastest and easiest way to do so is by using an SSH key.
- Generate a SSH key For example on ubuntu :
cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C <prenom.nom@domain.com>
Name it & protect it with a password. For the sake of this tutorial, let's name it "ECLIPSE_RSA".
- Link the public SSH key to your eclipse account (https://accounts.eclipse.org/user/login?destination=oauth2/authorize)
Go to "settings" \rightarrow "SSH Keys"
Then "Add new key"
- Try out the authentication with SSH key
Add host in the file "~/.ssh/config" :
Host eclipse
Hostname gitlab.eclipse.org
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/ECLIPSE_RSA
Try out the authentication with SSH key :
ssh -T gitlab
You should get :
Welcome to GitLab, @username !
Git remote with SSH
If you are a member of the Aidge gitlab group, you can interact directly with the repository without the Fork and Pull request model.
Clone using the SSH key
Cloning the git repo using the SSH authentication will automaticaly set the remote address with the ssh authentication.
git clone --recursive git@gitlab.eclipse.org:eclipse/aidge/aidge.git
However the submodules are cloned with https by default. You need to change the remote manually in each submodule.
Switching remote URLs from HTTPS to SSH
Inside a git repository :
-
List your existing remotes in order to get the name of the remote you want to change.
$ git remote -v > origin https://github.com/OWNER/REPOSITORY.git (fetch) > origin https://github.com/OWNER/REPOSITORY.git (push)
-
Change your remote's URL from HTTPS to SSH with the
git remote set-url
command.git remote set-url origin git@github.com:OWNER/REPOSITORY.git
-
Verify that the remote URL has changed.
$ git remote -v # Verify new remote URL > origin git@github.com:OWNER/REPOSITORY.git (fetch) > origin git@github.com:OWNER/REPOSITORY.git (push)