LoginSignup
1
0

More than 3 years have passed since last update.

git add *コマンドでは.gitignoreで指定したファイルを無視できないため、不整合でステージングエリアへ追加できない

Posted at
1 / 2

Laravel5.5でECサイトを作成している時にgit add できなくて苦戦したことを記録で残します。
git version 1.8.3.1です。

1、起きたこと

gitのmyprojectディレクトリでgit add * のコマンドを打ったときに以下のエラーが出ました。

【エラー文】
The following paths are ignored by one of your .gitignore files:
vendor
Use -f if you really want to add them.
fatal: no files added

これは要するに、.gitignoreファイルでvendorを無視しているからステージングエリアに追加できませんよ
と書いてあります。また、-fオプションを使うと追加できますよとアドバイスもありました。
そして、ステージングエリアには何もファイルが追加されていません。

.gitignoreファイルについてよく知らない人はこちらへ

-fオプションを使うとvendorもステージングエリアに追加されてしまうため今回は使用しません。

2、解決方法

git add . コマンドを実行して解決しました。

どうやら、git add *は全てのファイルを関係なくステージングエリアに追加しようとして.gitignoreでの指定したファイルとの不整合で追加できてなかったと思わます。
git add .コマンドでは問題なく.gitignoreで指定したファイルを無視してステージングエリアに追加する事ができた。

今後はgit add . コマンドを使用していこうと思っています。

1
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
1
0