Why is .gitignore not working when I use git add *?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
To satisfy github 100Mb requirement, I run the following to ignore some large files:
$ find ./* -size +100M | cat >> .gitignore
but when I run add * later, it is still adding the >100MB file to commit.
$ git add *
warning: LF will be replaced by CRLF in hw1/input/act_test.csv.
The file will have its original line endings in your working directory
How can I make this gitignore work?
Thanks in advance for ideas and advices.
add:
my intent is to make add *
not track the large csv file any more, following answer does not seem to work.
git gitignore ignore
add a comment |
To satisfy github 100Mb requirement, I run the following to ignore some large files:
$ find ./* -size +100M | cat >> .gitignore
but when I run add * later, it is still adding the >100MB file to commit.
$ git add *
warning: LF will be replaced by CRLF in hw1/input/act_test.csv.
The file will have its original line endings in your working directory
How can I make this gitignore work?
Thanks in advance for ideas and advices.
add:
my intent is to make add *
not track the large csv file any more, following answer does not seem to work.
git gitignore ignore
1
Are you sure you want to use./*
instead of.
? That'll add everything except what's in the root folder.
– Mad Physicist
Nov 29 '18 at 4:23
Also, have some of these files already been committed? If so, you will need to purge them. You can't alter past history with just ignore and commit.
– Mad Physicist
Nov 29 '18 at 4:25
1
Possible duplicate of How to make Git "forget" about a file that was tracked but is now in .gitignore?
– phd
Nov 29 '18 at 7:37
stackoverflow.com/questions/2100907/…
– phd
Nov 29 '18 at 7:38
@MadPhysicist, yes, I used add * to keep my project updated, then I can access it anywhere, I am the main contributor, so calladd *
often to keep it updated.
– Pythoner
Nov 30 '18 at 1:40
add a comment |
To satisfy github 100Mb requirement, I run the following to ignore some large files:
$ find ./* -size +100M | cat >> .gitignore
but when I run add * later, it is still adding the >100MB file to commit.
$ git add *
warning: LF will be replaced by CRLF in hw1/input/act_test.csv.
The file will have its original line endings in your working directory
How can I make this gitignore work?
Thanks in advance for ideas and advices.
add:
my intent is to make add *
not track the large csv file any more, following answer does not seem to work.
git gitignore ignore
To satisfy github 100Mb requirement, I run the following to ignore some large files:
$ find ./* -size +100M | cat >> .gitignore
but when I run add * later, it is still adding the >100MB file to commit.
$ git add *
warning: LF will be replaced by CRLF in hw1/input/act_test.csv.
The file will have its original line endings in your working directory
How can I make this gitignore work?
Thanks in advance for ideas and advices.
add:
my intent is to make add *
not track the large csv file any more, following answer does not seem to work.
git gitignore ignore
git gitignore ignore
edited Nov 30 '18 at 1:38
Pythoner
asked Nov 29 '18 at 3:57
PythonerPythoner
2,33611629
2,33611629
1
Are you sure you want to use./*
instead of.
? That'll add everything except what's in the root folder.
– Mad Physicist
Nov 29 '18 at 4:23
Also, have some of these files already been committed? If so, you will need to purge them. You can't alter past history with just ignore and commit.
– Mad Physicist
Nov 29 '18 at 4:25
1
Possible duplicate of How to make Git "forget" about a file that was tracked but is now in .gitignore?
– phd
Nov 29 '18 at 7:37
stackoverflow.com/questions/2100907/…
– phd
Nov 29 '18 at 7:38
@MadPhysicist, yes, I used add * to keep my project updated, then I can access it anywhere, I am the main contributor, so calladd *
often to keep it updated.
– Pythoner
Nov 30 '18 at 1:40
add a comment |
1
Are you sure you want to use./*
instead of.
? That'll add everything except what's in the root folder.
– Mad Physicist
Nov 29 '18 at 4:23
Also, have some of these files already been committed? If so, you will need to purge them. You can't alter past history with just ignore and commit.
– Mad Physicist
Nov 29 '18 at 4:25
1
Possible duplicate of How to make Git "forget" about a file that was tracked but is now in .gitignore?
– phd
Nov 29 '18 at 7:37
stackoverflow.com/questions/2100907/…
– phd
Nov 29 '18 at 7:38
@MadPhysicist, yes, I used add * to keep my project updated, then I can access it anywhere, I am the main contributor, so calladd *
often to keep it updated.
– Pythoner
Nov 30 '18 at 1:40
1
1
Are you sure you want to use
./*
instead of .
? That'll add everything except what's in the root folder.– Mad Physicist
Nov 29 '18 at 4:23
Are you sure you want to use
./*
instead of .
? That'll add everything except what's in the root folder.– Mad Physicist
Nov 29 '18 at 4:23
Also, have some of these files already been committed? If so, you will need to purge them. You can't alter past history with just ignore and commit.
– Mad Physicist
Nov 29 '18 at 4:25
Also, have some of these files already been committed? If so, you will need to purge them. You can't alter past history with just ignore and commit.
– Mad Physicist
Nov 29 '18 at 4:25
1
1
Possible duplicate of How to make Git "forget" about a file that was tracked but is now in .gitignore?
– phd
Nov 29 '18 at 7:37
Possible duplicate of How to make Git "forget" about a file that was tracked but is now in .gitignore?
– phd
Nov 29 '18 at 7:37
stackoverflow.com/questions/2100907/…
– phd
Nov 29 '18 at 7:38
stackoverflow.com/questions/2100907/…
– phd
Nov 29 '18 at 7:38
@MadPhysicist, yes, I used add * to keep my project updated, then I can access it anywhere, I am the main contributor, so call
add *
often to keep it updated.– Pythoner
Nov 30 '18 at 1:40
@MadPhysicist, yes, I used add * to keep my project updated, then I can access it anywhere, I am the main contributor, so call
add *
often to keep it updated.– Pythoner
Nov 30 '18 at 1:40
add a comment |
2 Answers
2
active
oldest
votes
Previously added files are not affected by, adding them later to gitignore. Take a backup of the files and delete the files locally and commit them. So, that they are not tracked by git. Now, Paste back the files to the original place and you can add the bigger filenames to gitignore. Now, git will not be tracking them, as they are considered fresh files.
Another way is to use, as suggested by @alfunx, git rm --cached <file>
. The file will be removed from cache(index) and once you commit, the file will not be tracked anymore. You can also update .gitignore accordingly to avoid any further tracking of the file.
Read more about it in gitignore documentation
A gitignore file specifies intentionally untracked files that Git
should ignore. Files already tracked by Git are not affected; see the
NOTES below for details.
[...]
NOTES
The purpose of gitignore files is to ensure that certain files not
tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
git rm --cached
.
Thanks for your answer, but my intent is to make add * not track the large csv file any more, this does not seem to work, when I calladd *
, it adds back the large file again.
– Pythoner
Nov 30 '18 at 1:39
1
Your shell expands*
to a list of every file in the directory, so Git sees every file listed explicitly. If you want git to check the directory contents for ignore processing, feed it the directory, usegit add .
(a dot). edit: ignore processing is to stop git auto-adding files, not to stop you adding them explicitly.
– jthill
Nov 30 '18 at 1:51
add a comment |
Rather than ignore the file (often I will add it back by calling add . method in later time), there is a better way to resolve the issue, git lfs
, see my usage below, this will help to push the large files to github.
$git lfs install
$git lfs track "*.csv"
$git add .gitattributes
$git add act_train.csv
$git commit -m "test lfs"
$git push
Done
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%2f53531624%2fwhy-is-gitignore-not-working-when-i-use-git-add%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Previously added files are not affected by, adding them later to gitignore. Take a backup of the files and delete the files locally and commit them. So, that they are not tracked by git. Now, Paste back the files to the original place and you can add the bigger filenames to gitignore. Now, git will not be tracking them, as they are considered fresh files.
Another way is to use, as suggested by @alfunx, git rm --cached <file>
. The file will be removed from cache(index) and once you commit, the file will not be tracked anymore. You can also update .gitignore accordingly to avoid any further tracking of the file.
Read more about it in gitignore documentation
A gitignore file specifies intentionally untracked files that Git
should ignore. Files already tracked by Git are not affected; see the
NOTES below for details.
[...]
NOTES
The purpose of gitignore files is to ensure that certain files not
tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
git rm --cached
.
Thanks for your answer, but my intent is to make add * not track the large csv file any more, this does not seem to work, when I calladd *
, it adds back the large file again.
– Pythoner
Nov 30 '18 at 1:39
1
Your shell expands*
to a list of every file in the directory, so Git sees every file listed explicitly. If you want git to check the directory contents for ignore processing, feed it the directory, usegit add .
(a dot). edit: ignore processing is to stop git auto-adding files, not to stop you adding them explicitly.
– jthill
Nov 30 '18 at 1:51
add a comment |
Previously added files are not affected by, adding them later to gitignore. Take a backup of the files and delete the files locally and commit them. So, that they are not tracked by git. Now, Paste back the files to the original place and you can add the bigger filenames to gitignore. Now, git will not be tracking them, as they are considered fresh files.
Another way is to use, as suggested by @alfunx, git rm --cached <file>
. The file will be removed from cache(index) and once you commit, the file will not be tracked anymore. You can also update .gitignore accordingly to avoid any further tracking of the file.
Read more about it in gitignore documentation
A gitignore file specifies intentionally untracked files that Git
should ignore. Files already tracked by Git are not affected; see the
NOTES below for details.
[...]
NOTES
The purpose of gitignore files is to ensure that certain files not
tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
git rm --cached
.
Thanks for your answer, but my intent is to make add * not track the large csv file any more, this does not seem to work, when I calladd *
, it adds back the large file again.
– Pythoner
Nov 30 '18 at 1:39
1
Your shell expands*
to a list of every file in the directory, so Git sees every file listed explicitly. If you want git to check the directory contents for ignore processing, feed it the directory, usegit add .
(a dot). edit: ignore processing is to stop git auto-adding files, not to stop you adding them explicitly.
– jthill
Nov 30 '18 at 1:51
add a comment |
Previously added files are not affected by, adding them later to gitignore. Take a backup of the files and delete the files locally and commit them. So, that they are not tracked by git. Now, Paste back the files to the original place and you can add the bigger filenames to gitignore. Now, git will not be tracking them, as they are considered fresh files.
Another way is to use, as suggested by @alfunx, git rm --cached <file>
. The file will be removed from cache(index) and once you commit, the file will not be tracked anymore. You can also update .gitignore accordingly to avoid any further tracking of the file.
Read more about it in gitignore documentation
A gitignore file specifies intentionally untracked files that Git
should ignore. Files already tracked by Git are not affected; see the
NOTES below for details.
[...]
NOTES
The purpose of gitignore files is to ensure that certain files not
tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
git rm --cached
.
Previously added files are not affected by, adding them later to gitignore. Take a backup of the files and delete the files locally and commit them. So, that they are not tracked by git. Now, Paste back the files to the original place and you can add the bigger filenames to gitignore. Now, git will not be tracking them, as they are considered fresh files.
Another way is to use, as suggested by @alfunx, git rm --cached <file>
. The file will be removed from cache(index) and once you commit, the file will not be tracked anymore. You can also update .gitignore accordingly to avoid any further tracking of the file.
Read more about it in gitignore documentation
A gitignore file specifies intentionally untracked files that Git
should ignore. Files already tracked by Git are not affected; see the
NOTES below for details.
[...]
NOTES
The purpose of gitignore files is to ensure that certain files not
tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
git rm --cached
.
edited Nov 29 '18 at 11:31
answered Nov 29 '18 at 4:07
Venkataraman RVenkataraman R
1,7441020
1,7441020
Thanks for your answer, but my intent is to make add * not track the large csv file any more, this does not seem to work, when I calladd *
, it adds back the large file again.
– Pythoner
Nov 30 '18 at 1:39
1
Your shell expands*
to a list of every file in the directory, so Git sees every file listed explicitly. If you want git to check the directory contents for ignore processing, feed it the directory, usegit add .
(a dot). edit: ignore processing is to stop git auto-adding files, not to stop you adding them explicitly.
– jthill
Nov 30 '18 at 1:51
add a comment |
Thanks for your answer, but my intent is to make add * not track the large csv file any more, this does not seem to work, when I calladd *
, it adds back the large file again.
– Pythoner
Nov 30 '18 at 1:39
1
Your shell expands*
to a list of every file in the directory, so Git sees every file listed explicitly. If you want git to check the directory contents for ignore processing, feed it the directory, usegit add .
(a dot). edit: ignore processing is to stop git auto-adding files, not to stop you adding them explicitly.
– jthill
Nov 30 '18 at 1:51
Thanks for your answer, but my intent is to make add * not track the large csv file any more, this does not seem to work, when I call
add *
, it adds back the large file again.– Pythoner
Nov 30 '18 at 1:39
Thanks for your answer, but my intent is to make add * not track the large csv file any more, this does not seem to work, when I call
add *
, it adds back the large file again.– Pythoner
Nov 30 '18 at 1:39
1
1
Your shell expands
*
to a list of every file in the directory, so Git sees every file listed explicitly. If you want git to check the directory contents for ignore processing, feed it the directory, use git add .
(a dot). edit: ignore processing is to stop git auto-adding files, not to stop you adding them explicitly.– jthill
Nov 30 '18 at 1:51
Your shell expands
*
to a list of every file in the directory, so Git sees every file listed explicitly. If you want git to check the directory contents for ignore processing, feed it the directory, use git add .
(a dot). edit: ignore processing is to stop git auto-adding files, not to stop you adding them explicitly.– jthill
Nov 30 '18 at 1:51
add a comment |
Rather than ignore the file (often I will add it back by calling add . method in later time), there is a better way to resolve the issue, git lfs
, see my usage below, this will help to push the large files to github.
$git lfs install
$git lfs track "*.csv"
$git add .gitattributes
$git add act_train.csv
$git commit -m "test lfs"
$git push
Done
add a comment |
Rather than ignore the file (often I will add it back by calling add . method in later time), there is a better way to resolve the issue, git lfs
, see my usage below, this will help to push the large files to github.
$git lfs install
$git lfs track "*.csv"
$git add .gitattributes
$git add act_train.csv
$git commit -m "test lfs"
$git push
Done
add a comment |
Rather than ignore the file (often I will add it back by calling add . method in later time), there is a better way to resolve the issue, git lfs
, see my usage below, this will help to push the large files to github.
$git lfs install
$git lfs track "*.csv"
$git add .gitattributes
$git add act_train.csv
$git commit -m "test lfs"
$git push
Done
Rather than ignore the file (often I will add it back by calling add . method in later time), there is a better way to resolve the issue, git lfs
, see my usage below, this will help to push the large files to github.
$git lfs install
$git lfs track "*.csv"
$git add .gitattributes
$git add act_train.csv
$git commit -m "test lfs"
$git push
Done
answered Nov 30 '18 at 1:29
PythonerPythoner
2,33611629
2,33611629
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.
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%2f53531624%2fwhy-is-gitignore-not-working-when-i-use-git-add%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
1
Are you sure you want to use
./*
instead of.
? That'll add everything except what's in the root folder.– Mad Physicist
Nov 29 '18 at 4:23
Also, have some of these files already been committed? If so, you will need to purge them. You can't alter past history with just ignore and commit.
– Mad Physicist
Nov 29 '18 at 4:25
1
Possible duplicate of How to make Git "forget" about a file that was tracked but is now in .gitignore?
– phd
Nov 29 '18 at 7:37
stackoverflow.com/questions/2100907/…
– phd
Nov 29 '18 at 7:38
@MadPhysicist, yes, I used add * to keep my project updated, then I can access it anywhere, I am the main contributor, so call
add *
often to keep it updated.– Pythoner
Nov 30 '18 at 1:40