git on mac osx: how to push filename cases to origin?
I have changed the case of some directories in my git repository.
Then I pushed them and noticed the cases where not updated.
Then I found this question:
git mv and only change case of directory
I have followed the advice to use:
git add -A git commit --amend -m 'updated cases' git push origin
but instead of success the git server is returning:
To firstname.lastname@example.org:kyogron/example.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'email@example.com:kyogron/example.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. 'git pull') before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details.
What can I now do to update the cases without breaking more in my git repo?
PS: To avoid this issue in future you can use:
git config core.ignorecase false
One Solution collect form web for “git on mac osx: how to push filename cases to origin?”
git push --force
since you have rewritten the last SHA1 with your –amend, after using
It won’t break your repo unless you have other collaborators having already pulled from your previous commit as explained in “How do I push amended commit to the remote git repo?”.
(in that case, you would need other options for publishing your fixed commit)
On OsX, this answer does suggest (to avoid this issue):
git config --unset-all core.ignorecase git config --system core.ignorecase false
The OP kyogron reports having found a working solution:
- Create a new branch and checkout this new branch.
- Then delete the
.DS_Storefile in the directory of the corrupted directory and rename it to new name.
- Then remove wrong directory in the repository (you can view them with
git ls-files) and commit this change.
- Again remove the
.DS_Storeand now rename the directory to the lower case name you want with