1

This might seem like a noob question but i couldn't find any solution to it. I have an apigility project cloned from the original repository. I have deleted the .git directory and kept the .gitignore file :

   nbproject
   ._*
   .~lock.*
   .buildpath
   .DS_Store
   .idea
   .project
   .settings
   composer.lock
   vendor/
   public/vendor/
   config/development.config.php
   config/autoload/local.php
   config/autoload/*.local.php
   !public/vendor/README.md
   data/cache/*
   !data/cache/.gitkeep

I have then made a "git init" in the root folder and my git repository was created. I have made a "git add .gitignore" and made an initial commit with it. After I tried to make a "git add ." but all my files are getting added to the staging area. I can't understand why because for example the .puppet directory is added to the .gitignore and it still gets added. I gave a shot to this solution Ignore files that have already been committed to a Git repository it doesn't solve my issue.

4
  • There is no .puppet directory listed in that .gitignore file...
    – larsks
    Commented Mar 16, 2015 at 18:42
  • it is maybe I forgot to paste it in the example. the composer.lock and the public/vendor can be considered valid examples as well.
    – Susy11
    Commented Mar 16, 2015 at 19:26
  • Can you also include in your question (a) the output of ls in the top-level directory and (b) the output of git status after you have performed the git add operation?
    – larsks
    Commented Mar 16, 2015 at 19:29
  • In almost every case, composer.lock should be in your repository, not ignored. Commented May 14, 2015 at 5:29

1 Answer 1

0

If the structure is:

 yourrepo/
    .git/
    .gitignore
    yourfiles

Then a git add . would respect the .gitignore.
If not, a git rm --cached -- wrongfile would remove it from the index, and a git status would ignore it because of the .gitignore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.