Search code examples
gitsshopenshiftlocalecloud9-ide

warning: setlocale: LC_ALL: cannot change locale (C.UTF-8) while using Cloud9 and Openshift


I am using Openshift to host my website/application, and using Cloud 9 as an online IDE to code the website in. Everytime I pushed code to the openshift git repo, or if I SSH'ed into openshift from Cloud9, I kept getting the following error:

warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)

The error would be intermingled with the git command or SSH login completing successfully, so it was more annoying rather than causing issue.

Searched and searched and finally found a solution combining two different approaches. See answer below.


Solution

  • On Cloud9, run the following commands:

    sudo locale-gen “en_US.UTF-8”
    
    sudo dpkg-reconfigure locales
    

    Then (still on cloud9), assuming you have already done rhc setup to link to your OpenShift account, do the following:

    rhc env-set -a <app_name> LC_ALL=en_US.UTF-8
    

    Then either try a git push, or ssh into openshift, and you should no longer see the errors.

    I’m not entirely sure if the sudo locale-gen and dpkg commands actually helped, but I know the moment I got to the rhc env set command it worked and removed the issue.

    You should be able to change the locale to something that suits you, but I did not find I needed to for my needs.

    Sources: