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:

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to ''
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

  • How can I set up my own local Git server on my own computer?
  • Problems upgrading Git with Homebrew
  • Mac OS X 10.10 merge tool git bugs
  • git on Mac OS X Lion
  • How do I search for all my git repositories on my Mac?
  • git: where is my configuration information coming from?
  • Apple CI / Xcode Service and Jenkins
  • git line-ending issues in macos
  • One Solution collect form web for “git on mac osx: how to push filename cases to origin?”

    You need:

    git push --force

    since you have rewritten the last SHA1 with your –amend, after using git mv.

    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_Store file 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_Store and now rename the directory to the lower case name you want with git mv
    Git Baby is a git and github fan, let's start git clone.