问题
I'm trying to add a ruby rails file to my repository in gitlab but it somehow wouldn't allow me to add the file saying that my file does not have commit checked out.
I've tried git pull, making the the file again and git adding but still wont work
error: '172069/08_lab_routes_controllers_views_172069_172188-Copy/adventure_game/' does not have a commit checked out fatal: adding files failed
回答1:
If you have a subdirectory with a .git
directory and try to git add .
you will see this message.
This can happen if you have a git repo and then create/clone another repo in a subdirectory under that repo.
回答2:
I had the same error Message. I fixed it by deleting the file which causes the error from my Directory.
I hope this helps =)
回答3:
You don't need to delete the entire file from the directory as the first answer suggests, I just had to delete the .git
directory, and then your git add .
will work
This happens for the reason @Mario Zigliotto suggested, there is another repo in a subdirectory under that repo.
回答4:
I had the same error message when trying to add multiple files using "git add ." I was able to add all those files one by one instead of all at the same time.
来源:https://stackoverflow.com/questions/56873278/how-to-fix-error-filename-does-not-have-a-commit-checked-out-fatal-adding