@@ -3,6 +3,33 @@ There is a lot of ways how to use git and sometimes a working solution can be ve
[[_TOC_]]
## HowTo add a specif ssh-key for your git account
Sometimes it might be useful to have different ssh-keys per project or have a special ssh-key just for github/gitlab.
Steps:
1. Generate a `ssh-keygen`
2. Add ssh-key to GitHub or GitLab account under settings
3. Write a `~/.ssh/config` file with a content like this
```
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_for_git
Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/id_rsa_for_gitlab
```
Make sure that you adjust the `Hostname` accordingly and be sure that you use ssh in your git repo:
```bash
$ git remote -v
origin git@github.com:USER/repo.git (fetch)
origin git@github.com:USER/repo.git (push)
```
show no `https` in the urls.
## HowTo Sync a GitHub and a GitLab repository
It is easy to import a GitHub repo into GitLab and the otherway around. However, if you want to make sure you can have both repos at the same state, you need to syncronize them.