Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git submodule add error: does not have a commit checked out

Tags:

git

bitbucket

I create a new git repository with the help of bitbucket called confusionmatrix. Now, I'm trying in another git repository (called workspace) add the confusionmatrix repository as submodule like this:

git submodule add https://[email protected]/..../confusionmatrix.git 

But I'm getting the following error:

'confusionmatrix' does not have a commit checked out

I already made this with other git repositories to the same repository "workspace" and worked well.

What I'm doing wrong?

like image 867
Ricardo Rocha Avatar asked Jun 27 '19 23:06

Ricardo Rocha


People also ask

How do you fix does not have a commit checked out?

This can happen if you have a git repo and then create/clone another repo in a subdirectory under that repo. In my case, I accidentally created a directory name ., inside the repository. Removing it solved the issue.

How do you git add all?

To add and commit files to a Git repositoryEnter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed.

What is git add command?

The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. However, git add doesn't really affect the repository in any significant way—changes are not actually recorded until you run git commit .

How do I commit in git?

To add a Git commit message to your commit, you will use the git commit command followed by the -m flag and then your message in quotes. Adding a Git commit message should look something like this: git commit -m “Add an anchor for the trial end sectionnn.”


1 Answers

As an FYI, the same message is shown if by accident you already have a .git folder in any of the subfolder under the folder you are trying to add. If that's the case, then delete the git subfolder and if any .vs file is there, delete that too. That was my case and I had the same error message.

like image 144
Muniro Avatar answered Sep 21 '22 13:09

Muniro