Uncaught GitCommandNotFound in cmd.py line 1276
Aider version: 0.77.0 Python version: 3.12.8 Platform: macOS-15.3.1-arm64-64bit Python implementation: CPython Virtual environment: Yes OS: Darwin 24.3.0 (64bit) Git information unavailable
An uncaught exception occurred:
Traceback (most recent call last):
File "cmd.py", line 1262, in execute
proc = safer_popen(
^^^^^^^^^^^^
File "subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "aider", line 8, in <module>
sys.exit(main())
^^^^^^
File "main.py", line 723, in main
git_root = setup_git(git_root, io)
^^^^^^^^^^^^^^^^^^^^^^^
File "main.py", line 130, in setup_git
user_name = repo.git.config("--get", "user.name") or None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "cmd.py", line 986, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "cmd.py", line 1599, in _call_process
return self.execute(call, **exec_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "cmd.py", line 1276, in execute
raise GitCommandNotFound(redacted_command, err) from err
git.exc.GitCommandNotFound: Cmd('git') not found due to: FileNotFoundError('[Errno 2] No such file or directory: 'git'')
cmdline: git config --get user.name
Tried running aider, which generated an exception. Tried having it automatically open a PR, and that failed too. Running macOS Sequoia 15.3.1 on a Mac Studio with an M2 Ultra. I also have git and everything else installed to manage my github repo from the CLI, FWIW.
Start to finish from install to error
Hope this information helps!
SorThanks for trying aider and filing this issue.
The fix is available in the main branch. You can get it by installing the latest version from github:
aider --install-main-branch
# or...
python -m pip install --upgrade --upgrade-strategy only-if-needed git+https://github.com/Aider-AI/aider.git
If you have a chance to try it, let me know if it works better for you. I'm going to close this issue for now, but feel free to add a comment here and I will re-open. Or feel free to file a new issue any time.
Same issue on a fresh 0.80.2.dev11+g3992681b:
# Uncaught GitCommandNotFound in cmd.py line 1276
Aider version: 0.80.2.dev11+g3992681b
Python version: 3.12.9
Platform: macOS-15.4-arm64-64bit
Python implementation: CPython
Virtual environment: Yes
OS: Darwin 24.4.0 (64bit)
Git information unavailable
An uncaught exception occurred:
Traceback (most recent call last): File "cmd.py", line 1262, in execute proc = safer_popen( ^^^^^^^^^^^^ File "subprocess.py", line 1028, in init self._execute_child(args, executable, preexec_fn, close_fds, File "subprocess.py", line 1963, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'git'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "aider", line 8, in
Please consider reporting this bug to help improve aider!
Open a GitHub Issue pre-filled with the above error in your browser? (Y/n) n
Traceback (most recent call last):
File "/Users/andrei/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/git/cmd.py", line 1262, in execute
proc = safer_popen(
^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.9/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1028, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/homebrew/Cellar/[email protected]/3.12.9/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 1963, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/andrei/.local/bin/aider", line 8, in <module>
sys.exit(main())
^^^^^^
File "/Users/andrei/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/main.py", line 729, in main
git_root = setup_git(git_root, io)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrei/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/aider/main.py", line 131, in setup_git
user_name = repo.git.config("--get", "user.name") or None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrei/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/git/cmd.py", line 986, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrei/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/git/cmd.py", line 1599, in _call_process
return self.execute(call, **exec_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andrei/.local/pipx/venvs/aider-chat/lib/python3.12/site-packages/git/cmd.py", line 1276, in execute
raise GitCommandNotFound(redacted_command, err) from err
git.exc.GitCommandNotFound: Cmd('git') not found due to: FileNotFoundError('[Errno 2] No such file or directory: 'git'')
cmdline: git config --get user.name
First upgraded, then installed with python -m pip install --upgrade --upgrade-strategy only-if-needed git+https://github.com/Aider-AI/aider.git
Thanks I will look into it.
Can you share any settings or switches you are using with aider?
I typically run it as: aider --edit-format diff --model sonnet --show-diffs --watch-files --no-auto-commits
But the same happens even without switches.
It might be not specific to aider – 0.79.2 from brew also breaks.
FWIW, after many iterations I have figured out what the issue was.
Here’s what’s happening:
- I have a
$HOME/.envwhere I define environment vars for various shells and interaction modes. -
python-dotenvtries to parse your$HOME/.envas an.envfile in the format ofKEY=VALUEpairs only — no export, no shell syntax. - When
aiderusespython-dotenv.load_dotenv(), it seesexport PATH=...and fails to parse it, silently or otherwise, overriding or nullifying my environment, especially thePATH, hence the missinggit.
Solution:
- Move
$HOME/.envto$HOME/.env.shand update rc files to source that instead. - Create a clean(er)
$HOME/.envthat follows theKEY=VALUEsyntax to be used tools likeaider,direnv, or Docker Compose