-1

Basically I have a repo where I cloned another repo. And now I want to add that sub-repo as a submodule of the parent repo but when I do git submodule add http://sub-repo path-to-sub-repo on the parent repo it gives me this error.

fatal: '/path-to-sub-repo' does not have a commit checked out

I suppose that this means that the sub repo has pending commits but no. Neither the parent repo nor the sub repo have pending commits or untracked files.

This is a similar question but the answer is to make a new repo which is not what I want.

s3b4s
  • 11
  • 6

1 Answers1

-1

I was using ~ in the path to the sub-repo

git submodule add https://sub-repo ~/path-to-sub-repo

I removed it and now it works fine.

git submodule add https://sub-repo path-to-sub-repo
s3b4s
  • 11
  • 6