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

  • Git error: Malformed input or input contains unmappable chacraters
  • How do you specify git URLs with spaces on Windows under cygwin?
  • Git pull invalid Windows file names
  • Delete a file from a Git repo with an apostrophe or quote in the name
  • Find commits that modify file names matching a pattern in a GIT repository
  • Git character encoding with Spanish characters
  • 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 git@github.com:kyogron/example.git
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'git@github.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?

    Regards,

    bodo

    PS: To avoid this issue in future you can use:

    git config core.ignorecase false
    

  • git clone is aborting due to possible repository corruption on the remote side even though memory settings are done properly
  • Promote all builds to master on Jenkins
  • GIT: What happens during branching?
  • Find a file in HEAD from its old name in an old git commit
  • Why is git subtree missing commits?
  • How to set timezone in tig?
  • 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.