Reputation: 83
I am learning how to use git. I am unable to add all the files once but individually can.
Error : doesn't have a commit checked out.
Its been long i have been trying to use git, have followed 3 videos. In the videos, they successfully able to do all the operations but I receive an error which they don't. I am not able to setup the git. I have attached the screen shot for your reference.
Also, please refer me to some tutorials or book in which i can get right from git installation. I am using Windows 10 and git version 2.27.0.windows.1
If somebody can, list down all the steps, so that i can follow it and if error occurs and can point out specific step and error. As there are many ways to setup git, i have to follow where i have incomplete project, which i can push and can restart working on code.
Early help would be much appreciated.
Upvotes: 0
Views: 143
Reputation: 52186
It looks like the pro1
subdirectory inside your repo is registered as a submodule.
To confirm this : run cat . gitmodules
from your repo base directory.
If this was unintented, follow this procedure to remove it :
git submodule deinit pro1
git rm pro1
rm -rf .git/modules/pro1
If you want to have pro1
as a submodule within itself : go into pro1
, and choose what should be checked out there :
cd pro1
git checkout some/branch
Upvotes: 0
Reputation: 955
It seem like you have another git repository(nested git repositories) initialized in the "pro1" directory. I don't think you require that. Remove ".git" from the "pro1" directory. You can use command on git bash(command line of which you have posted the screenshot):
rm -rf pro1/.git
Now use following command to add all the files:
git add .
or
git add -A
Another alternative is that you first commit and push the code in "pro1" directory and then try to push the code outside that directory. But that is not the recommended way of handling the git repositories.
You can refer Traversy Media tutorial for quick reference. It will work for most of cases. if still you face issue, just copy and paste that error on google, you will get the right answer.
Upvotes: 1