0

I'm learning to use Git. After installation I can open a Bash terminal on VS Code (I'm using Windows if that's relevant). Right after opening a Bash terminal, this command shows up automatically (the id and path are masked for privacy):

myid@machineid MINGW64 /c/Users/...
$ source C:/ProgramData/Anaconda3/Scripts/activate base
(base) 

I guess it means it's using Anaconda to run the Git command. However, it appears many CMD commands that otherwise work normally in a Windows terminal don't work. For example, I can't create a new folder. This error comes up:

$ mkdir test
bash: /c/ProgramData/Anaconda3/Library/usr/bin/mkdir: Permission denied
(base)

Similarly, commands like ls or touch just don't work. But I find pwd works. I look at /c/ProgramData/Anaconda3/Library/usr/bin and see there are a bunch of CMD command exe files in there, such as mkdir.exe, rm.exe. I also look at the Git installation directory and find a folder with similar exe commands (C:\Program Files\Git\usr\bin)

On the other hand, I can still use Git commands. So this works (after manually creating the folder test):

$ git init
Initialized empty Git repository in C:/Users/.../test/.git/
(base)

Also, if I don't use VS Code, but use a Git CMD then everything works just fine.

So the question is how I can fix it? More specifically, how can I direct Git to use Git command base in VS Code instead of depending on Anaconda base? What it currently means to me is that if I uninstall Anaconda then Git may not work in VS Code at all.

NonSleeper
  • 849
  • 1
  • 6
  • 17
  • 1
    It looks like the PATH changed after activate the base env. – SBMVNO Jan 31 '23 at 01:45
  • If you run git-bash directly does it work(without invoking Anaconda)? – lex Feb 01 '23 at 23:25
  • @Chris.C I can't open Git Bash (I don't know if it's because I'm using Windows or because it's the company's IT policy). But as said above I can run Git CMD just fine. – NonSleeper Feb 02 '23 at 05:21
  • 1
    I don't use Anaconda3 but it seems that, Anaconda modified your `~/.bashrc` (`C:\users\xxx\.bashrc` in Windows) or `~/.profile` or `~/.bash_profile` and add above line, then git-bash also use these file(s) for initialization. – lex Feb 02 '23 at 05:32
  • 1
    Maybe you can set git-bash to use another file instead. See https://stackoverflow.com/a/55010116/5007748 – lex Feb 02 '23 at 05:35

0 Answers0