local remote repository
ローカル環境のみでgitリポジトリを作り、履歴管理やブランチ操作を行いたい
-
dirname.git がリモートリポジトリの慣例
$ git init --bare --shared
- bareは作業ファイルをもたないpushされるための専用のリポジトリという意味
- sharedはこのリポジトリを共有可能にするためのオプション。これがないとpushしてもファイルを作成できない。
allow force push
remote: error: denying non-fast-forward
- local.git/config
[receive]
denyNonFastforwards = false // trueで拒否 がデフォルト、テンプレート使うのが楽
// テンプレートからはコピーしてくれないので都度コマンドを流す必要がある
// ↓ cp すればいくね?テンプレートは整合性あるだろうし
git config receive.denyNonFastForwards false //こっち
git config --system receive.denyNonFastForwards false //システム?ユーザーのグローバル設定かも、こっちではない
詳しくは ↓ の Server Configuration
https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
use template
リモートリポジトリ のテンプレを使うことで設定したのを使い回せる
- コマンドだと
[--template=<template_directory>]
git init --bare --shared --template=../template-git-init.git/
git init --bare --shared --template="$HOME\GitLocalSync\template-git-init.git\" && cp "$HOME\GitLocalSync\template-git-init.git\config" .\