GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — repo.index.add() method attempts to chmod files which it should not · Issue #2021 · gitpython-developers/GitPython

repo.index.add() method attempts to chmod files which it should not #2021

New issue
Copy link
New issue
Copy link
Closed
Bug
#2209
Closed
repo.index.add() method attempts to chmod files which it should not#2021
Bug
#2209
Copy link
Labels
acknowledgedhelp wanted

Description

@jrollins
jrollins
opened on Apr 7, 2025
Issue body actions

The behavior of the repo.index.add() method behaves differently than the CLI equivalent git add:

0$ git add *
0$ python3 -c 'import git; git.Repo.init().git.add("*")'
0$ python3 -c 'import git; git.Repo.init().index.add("*")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/conda/base/envs/cds/lib/python3.10/site-packages/git/index/base.py", line 885, in add
    entries_added.extend(self._entries_for_paths(paths, path_rewriter, fprogress, entries))
  File "/opt/conda/base/envs/cds/lib/python3.10/site-packages/git/util.py", line 176, in wrapper
    return func(self, *args, **kwargs)
  File "/opt/conda/base/envs/cds/lib/python3.10/site-packages/git/index/util.py", line 111, in set_git_working_dir
    return func(self, *args, **kwargs)
  File "/opt/conda/base/envs/cds/lib/python3.10/site-packages/git/index/base.py", line 745, in _entries_for_paths
    entries_added.append(self._store_path(filepath, fprogress))
  File "/opt/conda/base/envs/cds/lib/python3.10/site-packages/git/index/base.py", line 698, in _store_path
    istream = self.repo.odb.store(IStream(Blob.type, st.st_size, stream))
  File "/opt/conda/base/envs/cds/lib/python3.10/site-packages/gitdb/db/loose.py", line 233, in store
    chmod(obj_path, self.new_objects_mode)
PermissionError: [Errno 1] Operation not permitted: '/path/to/repo/.git/objects/02/60b9d2b53981a5ddbe20f3f0aae350b2806d22'
1$ 

I don't see any reason that the python-native methods should be doing anything different than what the CLI does.

Activity

  1. Byron
    added
    acknowledged
    help wanted
    on Apr 8, 2025
  2. Byron commented on Apr 8, 2025

    @Byron
    Byron
    on Apr 8, 2025
    Member
    More actions

    I totally agree - this was from a time when GitPython strived to implement Git independently. In retrospect, this was totally ill-advised, but here we are.
    It's probably not too difficult to make this works by doing bare git calls.

  3. Byron
    added the
    Bug
    issue type on Jul 20, 2026
  4. Byron
    added 3 commits that reference this issue on Aug 10, 2026

    fix: `index.add()` now supports filters (gitpython-developers#2021)

    139d0b1

    fix: `index.add()` now supports filters (gitpython-developers#2021)

    f202503

    fix: `index.add()` now supports filters (gitpython-developers#2021)

    93677a0
  5. Byron
    closed this as completedin #2209on Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedhelp wanted

    Type

    Bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.