我的gitignore没有工作

时间:2017-03-21 18:43:24

标签: android git gitignore

我试图为我找到解决方案,但我的.gitignore文件仍无法正常工作

我看到了this post,但它并没有帮助我。

这是我的gitignore文件:

# Created by https://www.gitignore.io/api/android,macos

### Android ###
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/dictionaries
.idea/libraries

# Keystore files
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

### Android Patch ###
gen-external-apklibs

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

但是当我进行重建时,我在SourceTree中看到了这个: enter image description here

libraryProjectFolder/Build文件夹中的所有文件 ()

2 个答案:

答案 0 :(得分:1)

Git已经在跟踪这些文件了,这就是你仍然可以看到它们的原因。

您应该在执行任何提交之前创建.gitignore。

如果要删除这些文件,可以参考following post。如果项目是新的,您可以创建一个新的存储库,复制您的文件并确保在执行第一次提交之前在新的repo中有.gitignore文件。

答案 1 :(得分:0)

我遇到的情况是我在gitignore上添加了一个文件,由于某种原因,我不知道它无法在gitignore上识别此文件,并且仍在我的工作区中显示。要忽略此文件,我使用了以下命令:

git rm --cached myfile

我希望它将来能对任何人有所帮助。

相关问题