Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
22.26k stars 2.07k forks source link

Aider tries to commit files that are in GitIgnore #2130

Closed zenturacp closed 5 days ago

zenturacp commented 3 weeks ago

Issue

It modifies files that is in .gitignore and when it wants to commit the files it failes because they are in Gitignore, its not supposed to commit files that are in the .gitignore, the file was added so it was modified, it should just not commit it

Committing local.settings.json before applying edits.
Unable to add C:\Code\X\local.settings.json: Cmd('git') failed due to: exit code(1)
  cmdline: git add C:\Code\X\local.settings.json
  stderr: 'The following paths are ignored by one of your .gitignore files:
local.settings.json
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"'
Unable to commit: Cmd('git') failed due to: exit code(1)
  cmdline: git commit -m chore: Add local.settings.json --no-verify -- C:\Code\X\local.settings.json
  stderr: 'error: pathspec 'C:\Code\X\local.settings.json' did not match any file(s) known to git'
Applied edit to local.settings.json
Applied edit to src\functions\folderSync.js
Unable to add C:\Code\X\local.settings.json: Cmd('git') failed due to: exit code(1)
  cmdline: git add C:\Code\X\local.settings.json
  stderr: 'The following paths are ignored by one of your .gitignore files:
local.settings.json
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"'
Unable to commit: Cmd('git') failed due to: exit code(1)
  cmdline: git commit -m feat: Add environment variable for API URL and fetch data from it in folderSync.js --no-verify -- C:\Code\X\local.settings.json
C:\Code\X\src\functions\folderSync.js
  stderr: 'error: pathspec 'C:\Code\X\local.settings.json' did not match any file(s) known to git'

Version and model info

Aider v0.60.0 Main model: anthropic/claude-3-5-sonnet-20241022 with diff edit format, infinite output Weak model: claude-3-haiku-20240307 Git repo: .git with 16 files Repo-map: using 1024 tokens, auto refresh VSCode terminal detected, pretty output has been disabled.

paul-gauthier commented 6 days ago

This should be fixed in the latest version. You can get it like this:

aider --upgrade

# or...

python -m pip install --upgrade --upgrade-strategy only-if-needed aider-chat

If you have a chance to try it, let me know if it works better for you.

paul-gauthier commented 5 days ago

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.