Thread (1 message) 1 message, 1 author, 2017-06-12

Re: bug? fetching from empty unnamed remote repos

From: Junio C Hamano <hidden>
Date: 2017-06-12 18:08:54

David Turner [off-list ref] writes:
$ git init empty-1
$ git init empty-2 
$ cd empty-1
$ git fetch ../empty-2
fatal: Couldn't find remote ref HEAD
fatal: The remote end hung up unexpectedly
The current repository does not know anything about empty-2
repository.  It does not have [remote "name"] section that points at
../empty-2 and it does not have a refspec to fetch.

Hence "git fetch ../empty-2" tries to fetch HEAD from that
repository by default.  It does not exist, and it fails.
But:
$ git init empty-1
$ git init empty-2 
$ cd empty-1
$ git remote add other ../empty-2
You told to your current repository to have [remote "other"]
section, that points at ../empty-2 and fetch with refs/heads/*:refs/remotes/other/*
as the refspec.
$ git fetch other
Hence "git fetch other" tries to fetch refs/heads/* into refs/remotes/other/*;
not having any matching source is not a crime---it is a simple noop.
# this works
So there is nothing surprising about all of the above as far as I
can see.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help