Search code examples
condagit-bashminiconda

Gibberish output when activating Miniconda environment in Git Bash


My Git Bash terminal in Windows works fine with all other git bash commands but for activating conda using Git Bash for an environment, output is all gibberish. I've not been able to find anyone else facing this issue. To get back I have to kill and start a new terminal. It is a new installation of Miniconda and I also had this same issue in a previous installation and also on a different environment. It works fine with Native Anaconda Prompt, but I love using Git Bash for my work flow so I would appreciate a way to solve this.

Megh@Meghs-PC MINGW64 ~
$ cd trial/


Megh@Meghs-PC MINGW64 ~/trial
$ conda activate .\\env 
(C:\Users\Megh00:01:22rialö© 
ÍåçèÀÍåçèó­ÐàÍÉÎÇ׶´ þ¯ôòéáì
¤ 

or

Megh@Meghs-PC MINGW64 ~/trial
$ conda activate ./env 
(C:\Users\Megh00:01:22rialö© 
ÍåçèÀÍåçèó­ÐàÍÉÎÇ׶´ þ¯ôòéáì
¤ 

Solution

  • Maybe it is linked to .env or .bashrc content.

    Following "How to add Conda to Git Bash (Windows)" from Felipe A. Moreno, you can add conda to your Git bash with:

    • go to the folder: Anaconda/etc/profile.d/
    • open a new instance of Git Bash to the correct directory.

    Now, so long as the path to your file has no spaces, you can add conda.sh to your .bashrc with this simple command:

    echo ". ${PWD}/conda.sh" >> ~/.bashrc
    

    As seen in "Setting Up Conda in Git Bash", you might need to use conda, not conda.sh.

    Then::

    reopen Git Bash, you still won’t see (base) in your prompt — that’s because you haven’t activated conda yet.
    To activate it, simply type the command conda activate

    So no .env in that case.