環境構築・リポジトリ管理 - Git

最終更新日: 2026-07-24

TOP(About this memo)) > 一覧(Git) > 環境構築・リポジトリ管理

help, version

config

設定の段階

設定コマンド

git config --system [システムへの設定]
git config --global [グローバルへの設定]
git config --local [ローカルへの設定]

設定ファイルの場所

初期設定

設定ファイルの確認

git config --local -l   # ローカルの設定
git config --global -l  # グローバルの設定

unset

git config --local --unset user.name
git config --local --unset user.email

(参考) その他のおすすめ設定

# パーミッションの変更を無視する
git config --local core.filemode false
# ファイル名の大文字・小文字の変更を検知する
git config --local core.ignorecase false
# カラー設定
git config --local color.ui true
git config --local color.diff auto
git config --local color.status auto
git config --local color.branch auto
# 日本語ファイル名をエスケープせずに表示
git config --local core.quotepath false
# 濁点つきのファイル・ディレクトリが分けて表示されてしまうUTF8-MAC問題の対策
git config --local core.precomposeunicode true

clone

remote

pushとリモート名

基本

リモート側で名前が変更された場合

git remote set-url origin <新しいURL>
git remote -v   # 確認

リモートリポジトリの作成

(参考) ローカルでpush可能なリポジトリを作成する場合

mirror(WIP)

SSH

sudoでのgit cloneの注意点

GitHubのSSH設定(注意点のみ)

SSH時のパスフレーズとGIT_SSH_COMMAND

fork

forkを使ったフロー

fork元の変更を取り込みたい場合

git remote add <適当なname> <fork元のURL>/xxx.git
git fetch <適当なname>
git checkout master
git merge <適当なname>/master

履歴まで含めてリポジトリをコピーしたい場合

エクスポート

submodule(WIP)

subtree(TODO)