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 — Encoding issue with tags in packed-refs file · Issue #2064 · gitpython-developers/GitPython

Encoding issue with tags in packed-refs file #2064

New issue
Copy link
New issue
Copy link
Closed
Bug
#2308
Closed
Encoding issue with tags in packed-refs file#2064
Bug
#2308
Copy link
Labels
acknowledgedhelp wanted
Milestone
v4.0

Description

@benmss
benmss
opened on Aug 6, 2025
Issue body actions

Tags found in the packed-refs file that can be created by the Git command git pack-refs do not have to be UTF8 encoded. In these cases, GitPython fails to read these tags due to assuming they should be UTF8 compatible.

The source for this issue is found here:
https://github.com/gitpython-developers/GitPython/blob/main/git/refs/symbolic.py#L124

with open(cls._get_packed_refs_path(repo), "rt", encoding="UTF-8") as fp:

A working example (using a repository with a non-utf8 tag):

git clone https://github.com/ACRA/acra
cd acra

Create a Python script with the following content:

import git
repo = git.Repo(".")
print(repo.tags)

Execute the script:

python script.py

Result:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 6216: invalid continuation byte

Activity

  1. Byron
    added
    acknowledged
    help wanted
    on Aug 6, 2025
  2. Byron commented on Aug 6, 2025

    @Byron
    Byron
    on Aug 6, 2025
    Member
    More actions

    Thanks for reporting!

    GitPython absolutely has a problem with encodings, in that it should use bytes in most places where it now uses strings, and the same is true for filesystem paths.

    Reacted by Ben Selwyn-Smith
  3. Byron
    added the
    Bug
    issue type on Jul 20, 2026
  4. Byron
    added this to the v4.0 milestone on Jul 26, 2026
  5. Byron commented on Jul 26, 2026

    @Byron
    Byron
    on Jul 26, 2026
    Member
    More actions

    When reviewing #2190 (comment) I realize that this can't be fixed properly without changing the types that are created by the ref traversal, after all, these can't have an encoding attached to them anymore.

    So no need to attempt this in V3.

  6. Byron
    added a commit that references this issue on Oct 25, 2026

    fix(refs): preserve non-UTF-8 names at native API boundaries (#2064)

    70d2fd5
  7. Byron
    closed this as completedin #2308on Oct 25, 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

      • v4.0No due date

      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.