Last active
September 3, 2022 10:31
-
-
Save kanguki/8b6d526390db85d99f812f59f5a72ec1 to your computer and use it in GitHub Desktop.
~/.ssh/config and ~/.gitconfig to work with multiple github accounts in one machine. you're welcome~~~
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[url "git@private1.github.com:someuser/private-repo-1"] | |
insteadOf = https://github.com/someuser/private-repo-1 | |
[url "git@private2.github.com:someuser/private-repo-2"] | |
insteadOf = https://github.com/someuser/private-repo-2 | |
[url "git@customName.github.com:keepThis"] | |
insteadOf = git@github.com:keepThis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/id_ed25519 | |
PreferredAuthentications publickey | |
AddKeysToAgent yes | |
IdentitiesOnly yes | |
#arbitrary, just change in your git remote url github.com to this arbitrary host | |
#i.e. git remote set-url origin git@dump.github.com:some-github-account/repo.git | |
Host dump.github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/another_id_ed25519 | |
PreferredAuthentications publickey | |
AddKeysToAgent yes | |
IdentitiesOnly yes | |
Host gitlab.custom.port | |
HostName gitlab.com | |
User git | |
Port 30000 #custom port | |
IdentityFile /home/mo/.ssh/rsa_key | |
PreferredAuthentications publickey | |
AddKeysToAgent yes | |
IdentitiesOnly yes | |
#when generating ssh-key-gen, you should start ssh-agent then add newly created key to ssh-agent, after that can you add it to github or gitlab | |
#to download private go modules: | |
#git config --global url."ssh://git@your_gitlab_endpoint_without_port_becsuse_you_add_Port_above".insteadOf "http://your_gitlab_endpoint_without_port_becsuse_you_add_Port_above" | |
#go env -w GOPRIVATE=your_gitlab_endpoint:your_custom_port_if_exist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment