LoginSignup
8
7

More than 1 year has passed since last update.

Git | .gitconfig を Github レポジトリで公開しよう! ( .gitconfig の include を使う )

Last updated at Posted at 2016-06-04

設定ファイルは「秘伝のタレ」になりがちですが、どんどん公開しみてはいかがでしょうか!

と言っても個人名とか、プロジェクト専用の部分とか、公開したくないものもあると思います。
そこで .gitconfig の include 機能を使います。

公開用ファイル

.gitconfig とは別に、好きなディレクトリに include 用ファイルを作って、 git 管理しておきます。
ファイル名はなんでも良いです。

たとえばエイリアス設定だけを公開する場合は、次のような感じで。

~/my_configs/.gitconfig_for_include

[alias]
  ck = checkout
  st = status -s

include する

前記のファイルを .gitconfig 本体から include します。

~/.gitconfig
+ [include]
+ path = ~/my_configs/.gitconfig_for_include

- [alias]
-  ck = checkout
-  st = status -s

[user]
  name  = yinaura
  email = example@email.com

結果

こうすることで「公開したい部分」だけを独立させて、レポジトリ管理できます。
わざわざ公普段の .gitconfig を、コピペしたりする必要はありません。

あとは Github に push するだけです!

参考

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

メンター受付

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