LoginSignup
0
0

Git管理をディレクトリごとにしたい!

Posted at

背景

Github, Bitbucket, Gitlab...

巷に広がるGit管理のサービスは多く, それぞれでアカウントやパスワードを設定することも少なくない.
ただgit config --globalで設定してしまうとそれぞれを切り替えて使わないといけなくなる.
それは困るので, 事前にディレクトリを作って, それ以下ではどのサービスのアカウントを使うかを設定する.

手順

サービス用のディレクトリの作成

mkdir github
cd github
git init

credentialの設定

.gitconfigを同じ階層にgithub用のconfigを作成(.gitconfig-github)

[user]
        name = hoge
        email = hoge
        password = hogehogehoge

[credential "https://github.com"]
        helper = <credential.helperのpath>

.gitconfigにgithub用の設定にアクセスするためのpathを設定

~~~
[includeIf "gitdir:access/to/your/github"]
    path = ~/.gitconfig-github

まとめ

ディレクトリごとにサービスごとのアカウント名, password, credential.helperの設定ができた.

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