LoginSignup
1
0

More than 1 year has passed since last update.

git clone時に hostを切り替えて行う

Last updated at Posted at 2021-12-08

背景

ユーザを一時的に使い分けてgit clone実行したい。
秘密鍵 id_rsaを変えずに 一時的に使い分けて指定したい。

秘密鍵を作成、公開鍵の登録

一時的に切り替えたいユーザ用の 秘密鍵を作成し、gitアカウントにて 公開鍵の登録

参考:
https://qiita.com/shizuma/items/2b2f873a0034839e47ce

~/.ssh/config の設定

$ cat ~/.ssh/config
Host [ホスト名]
  Hostname github.com
  User [ユーザ名]
  IdentityFile [秘密鍵の位置を指定]

git clone時

git clone git@[ホスト名]:[アカウント名]/[リポジトリ名].git

できた:relaxed:

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0