今天在使用eclips git中的add to Index,發現其無效,具體如下
問題描述:
通過export導入一個git java項目
在java工程中新增一個類文件IndicatorCalcTest.java
在eclips中選擇該文件,team->add to Index,操作后該文件未顯示+號
問題定位:
直接通過命令行進入IndicatorCalcTest.java文件所在目錄,命令執行git add IndicatorCalcTest.java,報如下錯誤
C:\Users\Administrator\git\dzhyun\FunctionTest\DzhYunHttpApiTest\src\test\java\c
om\gw\dzhyun\httptest>git add IndicatorCalcTest.java
The following paths are ignored by one of your .gitignore files:
FunctionTest/DzhYunHttpApiTest/src/test/java/com/gw/dzhyun/httptest/IndicatorCal
cTest.java
Use -f if you really want to add them.
fatal: no files added
om\gw\dzhyun\httptest>git add IndicatorCalcTest.java
The following paths are ignored by one of your .gitignore files:
FunctionTest/DzhYunHttpApiTest/src/test/java/com/gw/dzhyun/httptest/IndicatorCal
cTest.java
Use -f if you really want to add them.
fatal: no files added
問題解決
在百度中搜索The following paths are ignored by one of your .gitignore files:,找到如下文章
http://www.bestphper.cn/article-264.html
具體內容可訪問鏈接,大概的意思
.gitignore文件中有過濾,屏蔽了該文件
打開工程中
.gitignore文件,內容如下
.settings
bin
target
bin
target
src
猜想可能是把文件屏蔽了,去掉
.gitignore文件的src行,保存。
再次在eclips中選擇該文件,team->add to Index,操作后該文件顯示+號
在此,問題解決