Configure git not to use “.gitignore” but “gitignore”
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 :)
git gitignore
add a comment |
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 :)
git gitignore
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 ofgitignore
? 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 at 18:08
1
Possible duplicate of Is it possible to have a custom .gitignore? Read only access?
– mkrieger1
Nov 12 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 ofexclude
files).
– wizclown
Nov 12 at 18:24
add a comment |
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 :)
git gitignore
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 :)
git gitignore
git gitignore
edited Nov 12 at 18:17
asked Nov 12 at 18:04
wizclown
1431315
1431315
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 ofgitignore
? 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 at 18:08
1
Possible duplicate of Is it possible to have a custom .gitignore? Read only access?
– mkrieger1
Nov 12 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 ofexclude
files).
– wizclown
Nov 12 at 18:24
add a comment |
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 ofgitignore
? 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 at 18:08
1
Possible duplicate of Is it possible to have a custom .gitignore? Read only access?
– mkrieger1
Nov 12 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 ofexclude
files).
– wizclown
Nov 12 at 18:24
2
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 at 18:08
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 at 18:08
1
1
Possible duplicate of Is it possible to have a custom .gitignore? Read only access?
– mkrieger1
Nov 12 at 18:09
Possible duplicate of Is it possible to have a custom .gitignore? Read only access?
– mkrieger1
Nov 12 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 at 18:24
@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 at 18:24
add a comment |
1 Answer
1
active
oldest
votes
You should be able to change the ignore file by entering the following:
git config core.excludesFile gitignore
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267725%2fconfigure-git-not-to-use-gitignore-but-gitignore%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should be able to change the ignore file by entering the following:
git config core.excludesFile gitignore
add a comment |
You should be able to change the ignore file by entering the following:
git config core.excludesFile gitignore
add a comment |
You should be able to change the ignore file by entering the following:
git config core.excludesFile gitignore
You should be able to change the ignore file by entering the following:
git config core.excludesFile gitignore
edited Nov 12 at 18:57
wizclown
1431315
1431315
answered Nov 12 at 18:18
Major
19210
19210
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267725%2fconfigure-git-not-to-use-gitignore-but-gitignore%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 ofgitignore
? 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 at 18:08
1
Possible duplicate of Is it possible to have a custom .gitignore? Read only access?
– mkrieger1
Nov 12 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 at 18:24