my mistake, my last email should have read: $ cd path/to/the ... work in that deep directory ... ... realize that file.txt in that directory needs ignoring ... ... know relative path of both desired ignore file and cwd ... $ echo path/to/the/file.txt > ../../../.gitignore ... or with this script ... --CORRECTION-- $ git ignore file.txt