I'm trying to create a new git repository from existing folder. I've created a .gitignore
file in the root of the folder. But if I say
git add * git commit git push
files that should be ignored still get committed to the remote repository. I'm on Windows. Also I've bought a license for SmartGIT. It also seems to ignore .gitignore
. I have to manually select which new files to commit.
gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them. Igal S.
gitignore file must be edited and committed by hand when you have new files that you wish to ignore. . gitignore files contain patterns that are matched against file names in your repository to determine whether or not they should be ignored.
The . gitignore file's purpose is to prevent everyone who collaborates on a project from accidentally commiting some common files in a project, such as generated cache files. Therefore you should not ignore .
gitignore file prevents future untracked files from being added to the git index. In other words, any files that are currently tracked will still be tracked by git.
Try "git add .
" instead.
Also, it works for me (on Linux):
$ git init $ echo foo > .gitignore $ echo foo > foo $ echo bar > bar $ git add -v * The following paths are ignored by one of your .gitignore files: foo Use -f if you really want to add them. fatal: no files added
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With