2

I just updated elephant.io in my project with composer, and I am trying to push it to remote, but when I do that git seems to see elephant.io directory as a file and it does not push it? is this a bug? I am using git 1.7.11 on bitbucket.

EDIT

Probably is not the dot the problem but something else. Doing :

git ls-files --stage | grep 160000

I get

160000 8e151a58e931c87ef1b7d2d2124f5b8d79637d1e 0   vendor/wisembly/elephant.io

**EDIT 2: Solution ** The final problem was that I was including the vendor folder in the git, and the error comes from the packagest that comes with their .git configuration. Ignoring vendor folder solves the problem. Thank you both to Sven and Vonc

3
  • What is the error you are seeing? I tried to push a local directory containing a . and that worked perfectly.
    – Sedrik
    May 27, 2014 at 6:55
  • 1
    Maybe elephant.io is a submodule within your main repo? (stackoverflow.com/a/19290653/6309)
    – VonC
    May 27, 2014 at 6:55
  • 160000 8e151a58e931c87ef1b7d2d2124f5b8d79637d1e 0 vendor/wisembly/elephant.io , ok how can i fix this? (sorry I am new to git, I came from svn)
    – albanx
    May 27, 2014 at 6:57

2 Answers 2

3

Since elephant.io is a submodule with a special entry 160000 8e151a58e931c87ef1b7d2d2124f5b8d79637d1e, you need to make sure that:

  • you have added, committed and push any modification done in elephant.io

      cd vendor/wisembly/elephant.io
      git add . 
      git commit -m "my modifs to elephant.io"
      git push
    
  • then you would go back to the parent repo, add and commit the new special entry SHA1:

     cd ..
     git add .
     git commit -m "new revision of elephant.io"
     git push
    

But that only works if you have the right to push back to elephant.io (or you shouldn't make any modification in it, or at least your submodule should reference a fork of elephant.io that you own).

In any case, to be clear, elephant.io being "not" pushed has nothing to do with the fact it has a dot in its name.

As suggested by Sven, since composer takes care of the dependencies, you could simply ignore the vendor folder. That will make those submodules invisible from the parent repo.

2
  • I am getting still errors: # On branch master nothing to commit (working directory clean) . But that is strange because I am not on master branch but in the developer branch. can the .git folder inside elephant.io folder do any error, because it seems to be the original package git , not the one of my project?
    – albanx
    May 27, 2014 at 7:22
  • @albanx you would make elephant.io sources part of your repo, which isn't necessary. You could ignore vendors altogether as suggested.
    – VonC
    May 27, 2014 at 7:36
2

If you are using Composer, and there is no special requirement for you to include the dependencies in your own repository, I'd think it is a good idea to follow the suggestion of the Composer developers to NOT include the vendor folder in your own repository, but only add and commit the composer.lock file.

Add the line vendor/ to your .gitignore file in the topmost directory, and you are basically done.

More info: https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md

5
  • But I have to commit vendor packages on the production, ignoring them will not commit, right?
    – albanx
    May 27, 2014 at 7:23
  • What is your deployment process?
    – Sven
    May 27, 2014 at 7:24
  • Develop -- tests -- update on production on schedules updates.
    – albanx
    May 27, 2014 at 7:29
  • Anyway I am really considering to put on git ignore the vendor, it seems the right thing. (making a composer update in production every time there is a new package it is rare)
    – albanx
    May 27, 2014 at 7:34
  • Actually you would not run an update, but an install in production, because updates might pull in versions you haven't tested with.
    – Sven
    May 27, 2014 at 7:47

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.