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

Issue related to git submodules, tracking branches and custom remote names

From
STSergiu Todirascu <sergiu@getstoryteller.com>
Date
Apr 25, 2024, 13:00 UTC
Message-ID
<A46E73E9-2718-4243-8835-B69AB1DA39D1@getstoryteller.com>

Hi, I think there's an unexpected behaviour related to git submodules, tracking branches and custom remote names.

What did you do before the bug happened? (Steps to reproduce your issue)
1. Inside any git repo add a submodule via `git submodule add -b <branch> <repo-url>`
2. git submodule update --init
3. cd <submodule-repo> && git remote rename origin internal
3. git submodule update --remote
What did you expect to happen? (Expected behavior)
Command should be successful with: `Submodule path '<submodule>': checked out 'commit-hash'`
What happened instead? (Actual behavior)
`fatal: Unable to find refs/remotes/origin/branch revision in submodule path '<submodule>'`
What's different between what you expected and what actually happened?
As you can see in the error message, it's looking for the branch in the `origin` remote, which was renamed to `internal`.
Anything else you want to add:
I'd expect for git to either properly detect the changed remote or be able to specify it somewhere. I've looked into the https://git-scm.com/docs/gitmodules reference and couldn't find a setting for setting a custom remote there.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.39.3 (Apple Git-145) cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64 compiler info: clang: 15.0.0 (clang-1500.1.0.2.5) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh

[Enabled Hooks] commit-msg post-commit pre-merge-commit

Thanks for looking into it, Sergiu

Message 1 of 1 in “Issue related to git submodules, tracking branches and custom remote names”
  1. Sergiu TodirascuApr 25, 2024

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.