LoginSignup
0
0

More than 1 year has passed since last update.

globalにgitでignoreをsetする手順

Last updated at Posted at 2021-11-30

やり方

git環境は整っていることが前提

ファイルを作る

touch $HOME/.config/git/ignore

ファイルに書き込む

ignore
.DS_Store

拡張子指定で一括

ignore
*.code-workspace

試してみる

が正しければ,これだけでパスは通っているはずである,試しに動かそう

man_gitconfig
...
 Defaults to $XDG_CONFIG_HOME/git/ignore.
If $XDG_CONFIG_HOME is either not set or empty,
$HOME/.config/git/ignore is used instead.
See gitignore[5].
...

上手くいけばOK,ダメなら次の手順へ

パスを通す

git config --global core.excludesfile $HOME/.config/git/ignore

これをやると

.gitconfig
[core]
    excludesfile = /Users/SolunaEureka/.config/git/ignore

でパスが通るなぜわざわざこんなことやらにゃならんのだ

流石にコレなら動くだろう

パスを消す

git config --global --unset core.excludesfile      

理由は知らんけど消してもしばらく動く場合がある,つーか私はそうだった

おまけ

初めてgithubでレポジトリ作ったけど,作った時点で案内に乗せられてREADMEを作ると,強制的に「initコミット」が発生してしまい,既に手元に作り溜めしたファイルがある場合は,そのブランチにはプッシュできない・別ブランチにpushできてもプルリクできない,という「詰みの状況」が発生した,There isn’t anything to compare.って表示されていた,いや確かにそれはそうなのだが…

あとパスの挙動が謎すぎた,まぁ今はちゃんと動いてるからコレでよしとするか…

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