Link to home
Start Free TrialLog in
Avatar of SheppardDigital
SheppardDigital

asked on

Error when trying to commit a Git repository

I have a Spring Boot Web application, which lately I've noticed is now showing all files need to be committed, which is strange as I've not changed all files.

I've tried to commit the project to Git but I'm getting the following error;

"
You have both src/main and src/main/java/com/nationallocums/Application.java
You have both src/main and src/main/java/com/nationallocums/Application.java
"

Can anyone help me figure out why this is going wrong?
ASKER CERTIFIED SOLUTION
Avatar of pepr
pepr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SheppardDigital
SheppardDigital

ASKER

Thanks, I managed to fix it using the following

git rm -r --cached src/main          
git commit -m "blalblalba"       
git add .    
git commit -m "2blablalbla"

Open in new window

Thanks, for showing the fix (and for the points). Just curious... How it happened? Did you stage (add)  the files and later moved to another directory before committing?
I have no idea how it happened, as far as I know there were no changes to the files or folder structure.