Rahul Bhat
Rahul Bhat

Reputation: 113

Getting an error "GitCommandNotFound: Cmd('git') not found due to:" in Anaconda Spyder

Im Trying to clone a git repo using the GitPython in spyder. im using the below code.

from git import Repo
full_local_path = r'C:/New/Newfolder'
remote = f"https://(git path)/*/frontend_backup.git"
Repo.clone_from(remote, full_local_path)

But im getting an error

GitCommandNotFound: Cmd('git') not found due to: FileNotFoundError('[WinError 2] The system cannot find the file specified')
  cmdline: git clone -v https://(git path)/*/frontend_backup.git C:/New/Newfolder

The same command when executed in Anaconda Prompt, is getting executed successfully, but when tried to do the same in Spyder , getting such error.

Note: I have given the PATH for git.exe and python.exe in system variables.

Upvotes: 1

Views: 2170

Answers (1)

Rahul Bhat
Rahul Bhat

Reputation: 113

Found the answer.

Its because the anaconda environment(base) in which i was using the Spyder hadn't installed the git versions. The base env, doesnt let you install extra packages, you have to create another env and install all the packages needed. i created another env in anaconda and it solved the error.

Upvotes: 2

Related Questions