0

For reasons that do not add anything to this question1, I would like to know whether it is possible to configure git to use gitignore instead of .gitignore.

A similar situation is having git instead of .git as the git working dir of a repository, which can be easily accomplished by adding the line

gitdir: ./git

to a .git file living at the root folder of the project. Hence I wonder whether it is possible to tell git not to use .gitignore but another file to contain the rules for files and folders that need not to be tracked.

There are similar questions suggesting the use of $GIT_DIR/info/exclude as a solution. Even though this leverages in practice the same mechanisms used by the gitignore file, my question is whether the actual .gitignore could be assigned to be some other file.


1 For the curious reader: I sync my personal machines, but I do not want to sync hidden files and folders since I like to have different configuration files on different machines. Still, I would like my git repositories to be in sync with the minimum possible effort. This is something I only do with my own projects, where I am often the only contributor -- so please let us not discuss bad and good practices of git usage, and instead keep the focus on the actual question :)
wizclown
  • 313
  • 1
  • 4
  • 16
  • 2
    If there was a way to support this, I'd imagine you'd have to set it at the repository level, since the .gitignore file gets checked into source control. Which means that even if you get your own repository configured this way, what are you doing to do when you clone some other repo that uses `.gitignore` instead of `gitignore`? Seems like you're just setting yourself up for a world of pain. Instead of hacking the system, seems like you should amend your syncing process to handle .gitignore files properly. – mason Nov 12 '18 at 18:08
  • 1
    Possible duplicate of [Is it possible to have a custom .gitignore? Read only access?](https://stackoverflow.com/questions/6117109/is-it-possible-to-have-a-custom-gitignore-read-only-access) – mkrieger1 Nov 12 '18 at 18:09
  • @mason Thank you for your input. As stated in the footnote I do not wish to use this in any repository that even remotely (pun intended) sees a git remote. So this has very little to do with ordinary, professional git usage and it's just a question that came out of curiosity. I have some folders synced with Synology's Cloud Station Drive, which either syncs all dotted files or none of them, hence my original question. Now it's about finding an answer, more than finding a solution (which obviously exists in the form of `exclude` files). – wizclown Nov 12 '18 at 18:24

1 Answers1

1

You should be able to change the ignore file by entering the following:

git config core.excludesFile gitignore
wizclown
  • 313
  • 1
  • 4
  • 16
Major
  • 544
  • 4
  • 19