git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Super long branch names corrupt `.git/config`

From
BOBen Olive <sionide21@gmail.com>
Date
Oct 4, 2012, 17:15 UTC
Message-ID
<CAAmo=1BU5N8nbonEb1aZEx=-e8VexwsE74pjm_56dXmCDK+K6g@mail.gmail.com>

My `.git/config` can be corrupted if I try to get a local branch with an extremely long name to track a remote branch.

Here is a (contrived) example to reproduce the issue:
    $ cd /tmp
    $ mkdir buggyrepo otherrepo
    $ cd buggyrepo/ && git init && cd -
    $ cd otherrepo/ && git init && cd -
    $ cd buggyrepo/
    $ echo foo > MYFILE
    $ git add MYFILE && git commit -m "Initial"
    $ git remote add otherrepo ../otherrepo/
    $ git checkout -b `ruby -e "puts 'a'*200"`
    $ git push -u otherrepo `ruby -e "puts 'a'*200"`
    fatal: bad config file line 11 in .git/config
    $ git status
    fatal: bad config file line 11 in .git/config
Workaround available: Just delete the offending entry.
I tested this with 1.7.12.2
--Ben Olive
Next: Jeff King
Message 1 of 6 in “Super long branch names corrupt `.git/config`”
  1. Ben OliveOct 4, 2012
  2. Jeff KingOct 4, 2012
  3. Junio C HamanoOct 4, 2012
  4. Jeff KingOct 5, 2012
  5. Andrew ArdillOct 5, 2012
  6. Jeff KingOct 5, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.