Trouble getting .gitignore files to work on OSX and Tower git GUI

Go To StackoverFlow.com

1

I have a cache directory I'm trying to have ignored by git which lives in my CMS's root directory here:

/files/cache/

I've tried the following variations in a .gitignore file at the root of the project:

/files/cache
/files/cache/*
files/cache
files/cache/*

But the files still show up in Tower ready to be staged - the only other thing I can think of is that I'm using comments in the file like this:

# comment
/files/cache

Just not sure what I've missed sorry - any help would be much appreciated

2012-04-04 03:52
by CMSCSS


3

  1. Are the files in question untracked? Please note that files that are already tracked by Git can't be ignored. In that case you'd have to untrack them and commit the deletion, first.

  2. In Tower's "Status" view, which view mode do you use? If we're talking about folders (not only individual files) matched by a pattern, "ALL" mode will continue to show the folder as untracked (while also hiding individual files). "MODIFIED" will hide the matched patterns completely.

2012-04-04 17:45
by Tobidobi
Yes they're tracked. Thank you, I now understand what's going on - I'm trying to exclude them after my initial commit. Is there a way to untracked them by matching a pattern or do I have to untracked all of these cache files manually? These files seemed to be owned by the MAMP www user and are causing all sorts of issues in Tower - like endlessly redrawing an alert dialogue box until I force quit the app - CMSCSS 2012-04-05 23:06
I've been trying the following: git rm --cached file.to.remove but keep getting the following error -bash: git: command not found which I don't really understand as git is installed - unless Tower installs a version - CMSCSS 2012-04-06 00:07
I'm not sure how Tower is making branches and doing commits but I guess git isn't installed because I can't seem to run any git command locally in the Terminal - will install now - CMSCSS 2012-04-06 00:14
Weird, I've just run the git installer but I can't run git --version or git rm -r directory-nameCMSCSS 2012-04-06 00:16
Although I know nothing about profile paths, I've tried adding export PATH=$PATH:/usr/local/bin:/opt/local/bin:/opt/bin:~/bin to ~/.profile but I still can't run git --versionCMSCSS 2012-04-06 00:24
Got it working in OSX lion by: 1. reinstalling git, 2. creating a file called: .bash_profile in my user home directory, 3. running: ~/.bash_profile in the termina - CMSCSS 2012-04-06 00:28
So most of my issues with Tower was to do with MAMP running as www/mysql creating all sorts of permissions issues. Now I'm running MAMP as username/username I've been able to remove files from the index, run a commit and then add the cache and tmp directories to my .gitignore fil - CMSCSS 2012-04-06 00:49


0

Put this .gitignore in /files/.gitignore

cache

and commit it.

2012-04-04 03:59
by Greg Kopff
Ads