Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* URLを変えることなくアカウントごとにSSHキーを使い分ける ...
** 問題 [#f0ff5498]
- GitHubに作るリポジトリのSSHのURLは、'''git@github.com:u...
- 複数アカウントがある時、URLを変えることなくSSHキーを使...
** 解決方法 [#i638ad4c]
- 以下のように、SSHのconfigにアカウントごとのHost設定を用...
- 次に、GitのconfigにアカウントのURLをinsteadOfでSSHのHos...
- これで、'''git clone git@github.com:user1/test20241228....
*** ~/.ssh/config [#ed33a4a7]
Host github.com
User git
IdentityFile ~/.ssh/default.key.pem
IdentitiesOnly yes
Host user1-github
HostName github.com
User git
IdentityFile ~/.ssh/user1.key.pem
IdentitiesOnly yes
Host user2-github
HostName github.com
User git
IdentityFile ~/.ssh/user2.key.pem
IdentitiesOnly yes
*** ~/.config/git/config [#kb183044]
[url "git@user1-github:user1/"]
insteadOf = git@github.com:user1/
[url "git@user2-github:user2/"]
insteadOf = git@github.com:user2/
** 補足 [#v6fb8eec]
- なお、上記の場合、 '''git clone git@user1-github:user1/...
- が、URLが変わるのでやや面倒
終了行:
* URLを変えることなくアカウントごとにSSHキーを使い分ける ...
** 問題 [#f0ff5498]
- GitHubに作るリポジトリのSSHのURLは、'''git@github.com:u...
- 複数アカウントがある時、URLを変えることなくSSHキーを使...
** 解決方法 [#i638ad4c]
- 以下のように、SSHのconfigにアカウントごとのHost設定を用...
- 次に、GitのconfigにアカウントのURLをinsteadOfでSSHのHos...
- これで、'''git clone git@github.com:user1/test20241228....
*** ~/.ssh/config [#ed33a4a7]
Host github.com
User git
IdentityFile ~/.ssh/default.key.pem
IdentitiesOnly yes
Host user1-github
HostName github.com
User git
IdentityFile ~/.ssh/user1.key.pem
IdentitiesOnly yes
Host user2-github
HostName github.com
User git
IdentityFile ~/.ssh/user2.key.pem
IdentitiesOnly yes
*** ~/.config/git/config [#kb183044]
[url "git@user1-github:user1/"]
insteadOf = git@github.com:user1/
[url "git@user2-github:user2/"]
insteadOf = git@github.com:user2/
** 補足 [#v6fb8eec]
- なお、上記の場合、 '''git clone git@user1-github:user1/...
- が、URLが変わるのでやや面倒
ページ名: