全局gitignore导致的文件被忽略~“The following paths are ignored by one of your .gitignore files.”

it2022-05-05  103

要把android库代码持续集成,需要放到docker里编译, 但是‘gradlew’默认没有被添加。 手动添加时, 提示

“The following paths are ignored by one of your .gitignore files.”

但是项目目录下明明没有对应规则。

 

这时使用命令“git check-ignore -v gradlew”测试是哪个gitignore文件导致。 比如我的测试结果:

~/E/mediaplayer ❯❯❯ git check-ignore -v gradlew ✘ 1 master ✖ ◼ /Users/along/.gitignore_global:5:gradlew gradlew

打开看下内容:

~/E/mediaplayer ❯❯❯ cat /Users/along/.gitignore_global master ✖ ◼ *~ .DS_Store *.iml .svn gradlew gradle/* *.li gradle.properties.orig maven/* .vscode/c_cpp_properties.json .vscode/settings.json maven/* maven/ .externalNativeBuild/* .externalNativeBuild/*

果然里面默认把‘gradlew’添加到忽略列表中了。

去掉就正常了。

 

使用git这么久,才知道还有个全局gitignore, ?

活到老学到老

 

参考: https://stackoverflow.com/questions/9436405/git-is-ignoring-files-that-arent-in-gitignore

 


最新回复(0)