0

Unable to commit files in Android Studio 3.1.1, getting below error:

        Commit failed with error 0 files committed, 2 files failed to commit:
    Will not add file alias 'app/src/main/java/com/LoginFragment.java' 
('app/src/main/java/com/LogInFragment.java' already exists in index)
Sia
  • 47
  • 1
  • 1
  • 9

1 Answers1

1

The main reason for this happening, you create the two files with the same name (ignore case). By default git check the file name with ignore case.

If you really want to keep these both file then you need to tell git not to check the file name with the ignore case

You can edit .git/config

[core]
  ignorecase = false

Also you can set it globally

$ git config --global core.ignorecase false

If you want to keep one of the file then you have to delete the other file.

git rm oldfile
git add .
git commit -m "message"

You could refer to the git rm documentation to explore more

Deb
  • 2,922
  • 1
  • 16
  • 32