Skip to content

Instantly share code, notes, and snippets.

@bhubr
Created December 5, 2023 02:52
Show Gist options
  • Save bhubr/51914d4e1030fea4e17a2b8980d9a7ec to your computer and use it in GitHub Desktop.
Save bhubr/51914d4e1030fea4e17a2b8980d9a7ec to your computer and use it in GitHub Desktop.
Connect to GitLab with custom SSH key
Assuming I put this in `~/.ssh/config`:
```
Host gitlab-public
HostName gitlab.com
User gluser
ForwardAgent yes
IdentityFile /Users/myuser/.ssh/id_ed25519_gitlab_public
```
I can set the GitLab remote like so:
```
git remote add gitlab git@gitlab-public:gluser/my-sample-project.git
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment