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

Allowing "/" in the name of a git remote is a strange choice

From
Per Cederqvist <ceder@lysator.liu.se>
Date
Jul 3, 2025, 19:33 UTC
Message-ID
<CAHx6-Um1dq0xJ-RkW+qXe=sEa6JGViSJxjzNw56u55DHLYoT2Q@mail.gmail.com>
Today I realized that git accepts "/" in a remote name.

This can lead to problems. I have a repository that contains a branch called "master" and another called "chat/master". Just for fun, I added a second remote in this repository and named it "origin/chat".

Now, does "refs/remotes/origin/chat/master" refer to the branch "chat/master" from "origin", or the branch "master" from "origin/chat"? Git seems to think it refers to both:

Show 7 quoted lines
> $ git fetch --all
> Fetching origin
> From $PRIVATE_URL
>  + 4e31956300f...30e26ebbb19 chat/master -> origin/chat/master  (forced update)
> Fetching origin/chat
> From  $PRIVATE_URL
>  + 30e26ebbb19...4e31956300f master     -> origin/chat/master  (forced update)
Every time I run "git fetch --all" git updates the origin/chat/master ref twice.

If it was up to me, I'd add a check to valid_remote_name() to ensure the name doesn't contain any "/" character. I doubt it is used often.

    /ceder
Next: Junio C Hamano
Message 1 of 18 in “Allowing "/" in the name of a git remote is a strange choice”
  1. Per CederqvistJul 3, 2025
  2. Junio C HamanoJul 4, 2025
  3. Patrick SteinhardtJul 4, 2025
  4. Lidong YanJul 4, 2025
  5. Lidong YanJul 4, 2025
  6. Junio C HamanoJul 4, 2025
  7. Per CederqvistJul 4, 2025
  8. Jeff KingJul 5, 2025
  9. remote: detect collisions in remote namesJeff King, Jul 5, 2025
  10. Patrick SteinhardtJul 7, 2025
  11. Jeff KingJul 7, 2025
  12. Junio C HamanoJul 7, 2025
  13. Jeff KingJul 8, 2025
  14. Jeff KingJul 8, 2025
  15. Junio C HamanoJul 8, 2025
  16. Jeff KingJul 9, 2025
  17. Junio C HamanoJul 7, 2025
  18. Raymond E. PascoJul 9, 2025

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.