Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitignore not ignoring certain project.properties

Tags:

git

android

I am using the github app for windows and mac and I am having a problem with my .gitignore file.

I am trying to ignore the project.properties file that gets generated when switch between my two machines but I simply cannot seem to get it to work.

Below is a copy of my .gitignore, and it seems to be working well for everything except for the project.properties, as well as the gen/* that I have in there yet that is less annoying.

I have been researching this for a while and haven't found an answer, I would appreciate any help!

# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/

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

# Proguard folder generated by Eclipse
`enter code here`proguard/

#Log Files
*.log

project.properties
*.properties
project.properties
like image 402
tallaghi Avatar asked Jun 02 '14 00:06

tallaghi


People also ask

Why is .gitignore not ignoring my files?

gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.

Why git ignore is not working?

This is because Git can only ignore the untracked files. Thus, you need to check the repository and make sure that the file that you are trying to ignore is not added to the repository. If it is, you should remove the file from your repository, and then copy the contents of the file and add its name to . gitignore.

How do I force git to ignore a file?

You can create a . gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make a commit. To share the ignore rules with other users who clone the repository, commit the . gitignore file in to your repository.


1 Answers

I suspect you added the project.properties line to .gitignore after that file had been committed.

What you need to do is the following:

git rm --cached project.properties

and for gen/*

git rm --cached gen/

Then commit.

the --cached option will unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone. git-rm

like image 124
Jeremy W Avatar answered Sep 24 '22 06:09

Jeremy W