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

git-fetch does not work from .git subdirectory

From
TTTimur Tabi <timur@freescale.com>
Date
Nov 20, 2012, 22:24 UTC
Message-ID
<50AC0316.7090002@freescale.com>

I was under the impression that git commands which affect repository (as opposed to the local file system) work from any subdirectory inside the repository. For example:

[b04825@efes linux.cq-test]$ git log -1
commit f35d179fde24be5e1675b1df9f7a49b8d95561b2
Author: Timur Tabi <timur@freescale.com>
Date:   Wed Oct 31 15:56:20 2012 +0200
...
[b04825@efes linux.cq-test]$ cd .git
[b04825@efes .git]$ git log -1
commit f35d179fde24be5e1675b1df9f7a49b8d95561b2
Author: Timur Tabi <timur@freescale.com>
Date:   Wed Oct 31 15:56:20 2012 +0200
...
It appears, however, that git-fetch does not work this way:
[b04825@efes linux.cq-test]$ git fetch upstream master
From ../linux-2.6
 * branch            master     -> FETCH_HEAD
[b04825@efes linux.cq-test]$ cd .git
[b04825@efes .git]$ git fetch upstream master
fatal: '../linux-2.6.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

This makes it complicated because git hooks run from the .git directory on normal repositories, but they run from the top-level directory on bare repositories. Apparently, you need to be in the top-level directory for git-fetch to run in any kind of repository.

-- 
Timur Tabi
Linux kernel developer at Freescale
Next: Patrik Gornicz
Message 1 of 3 in “git-fetch does not work from .git subdirectory”
  1. Timur TabiNov 20, 2012
  2. Patrik GorniczNov 22, 2012
  3. Timur TabiNov 26, 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.