コマンドで .gitignore、README、LICENSE、その他のファイルの作成を自動化することで、git ワークフローを最適化したいと考えていますgit init
。
これを行うには、http://git-scm.com/docs/git-init で RTFM を実行するgit init
と、次のいずれかを実行するように指示されます。
- 使う
git init --template=<template_directory>
けどめんどくさい。 - $GIT_TEMPLATE_DIR 環境変数の内容を変更しますが、変更したくありません。
init.templatedir
構成変数を設定します。今、私たちは話しています!
だから私sudo mkdir /usr/share/git-core/templates/my_template
とその中のtouch
いくつかのファイル、次に私vim ~/.gitconfig
と追加:
[init]
templatedir = /usr/share/git-core/templates/my_template
そしてgit config -l
私に言います:
...
init.templatedir=/usr/share/git-core/templates/my_template
...
自分自身に満足して、開発プレイグラウンド ディレクトリに移動し、次のことを行います。
$ git init
Initialized empty Git repository in /the/current/directory
$ ls -a
. .. .git
残念なことに...ファイルはどこにありますか? :(
クイックチェック:
$ ls -a /usr/share/git-core/templates/my_template
. .. .gitignore LICENSE README.md
$ git --version
git version 1.8.2.1
それも$ git init --template=/usr/share/git-core/templates/my_template
うまくいかないようです。
それで、私がここで間違っているのは何ですか?構成ディレクティブが正しくありませんか? テンプレートまたはその場所が間違っていますか (私は OSX を使用しています)。テンプレートは git リポジトリにする必要がありますか? むき出し?