1

I have pulled a company repo down and started working; the initial branch was master. In attempting to git checkout I'm encountering the following error consistently (backslash = line break):

git -c diff.mnemonicprefix=false -c core.quotepath=false -c \
    credential.helper=sourcetree checkout master 
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.  #so far, so good..


git -c diff.mnemonicprefix=false -c core.quotepath=false \
     -c credential.helper=sourcetree submodule update --init --recursive 
fatal: no submodule mapping found in .gitmodules for path 'vendor/omnipay/pin'
Completed with errors, see above

I have searched for answers on this but all of them involve the presence of some reference to submodule somewhere, including this one here. However:

  1. .git/config - contains no reference to submodule(s) at all

  2. vendor/omnipay/pin - this directory is empty including no hidden dot-files.

  3. There is no string submodule in vendor/omnipay or even vendor/ for that matter

Again, other posts don't seem to apply as there is no file or submodule line to reference/remove. What is the problem here and how do I fix it?

Community
  • 1
  • 1
Oliver Williams
  • 5,966
  • 7
  • 36
  • 78
  • What's the output of `git ls-tree HEAD -- vendor/omnipay/pin`? – Pockets Feb 23 '17 at 21:32
  • that returns `160000 commit 04e778e9689882d4c40419263014068b69b93168 vendor/omnipay/pin` - but I do know know what that means – Oliver Williams Feb 23 '17 at 22:54
  • Is there a `.gitmodules` file at the root of the repo (on `master`) and if so, can you edit your OP with its contents? (I would also advise `git log master -- .gitmodules` if no such file is present, to see if one ever existed.) – Pockets Feb 23 '17 at 23:31
  • `git log master -- .gitmodules` returns nothing. Your command does work for `-- index.php`, so I suppose .gitmodules never existed - or how could I search all branches? This happens on checkout between any two branches. – Oliver Williams Feb 24 '17 at 00:28
  • http://stackoverflow.com/questions/372506/how-can-i-search-git-branches-for-a-file-or-directory – Pockets Feb 24 '17 at 00:33

1 Answers1

1

that returns 160000 commit 04e778e9689882d4c40419263014068b69b93168 vendor/omnipay/pin

It is a "gitlink", a special entry in the index, recording the sHA1 for the root tree of a nested Git repository.
That is why the folder appears empty: it is a placeholder, for a nested repository.

If you have a .gitmodules file, there should be an entry mentioning where to look for the remote repository which is supposed to be checked out at that path.

If not, try at least a git rm vendor/omnipay/pin (no trailing slash), followed by a git submodule update --init --recursive

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250