0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GithubでPushするアカウントをリポジトリごとに切り替える個人的なメモ

Posted at

はじめに

GithubでPushするアカウントをリポジトリごとに切り替えたいです。
例えば~/github/repo1というリポジトリで作業したときrepo1の中ではuser1でpushしますが、~/github/repo2というリポジトリではuser2でpushしたいということです。

やり方

【2021/7/6 追記】ディレクトリごとに GitHub アカウントを自動的に切り替える設定の手順通りに進める。
~/.gitconfig_subのファイルでは以下のようにする。

.gitconfig_sub
[core]
        sshCommand = ssh -i ~/.ssh/user2
[user]
        name  = user2
        email = user2@users.noreply.github.com

sshCommandは使用する鍵を指定してます。

参考

【2021/7/6 追記】ディレクトリごとに GitHub アカウントを自動的に切り替える設定
coresshcommand-設定を使う方法

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?