Re: Copieing git repository to another disk is dangerous ! Especially in combination with remotes set to local repositories !
- From
- Konstantin Khomoutov <kostix@bswap.ru>
- Date
- Dec 4, 2025, 09:04 UTC
- Message-ID
- <fgjktagigkapjtmx5mxxzkoll5krt6fvdhcsjhed6esalhabp3@famahk7xyaah>
- In-Reply-To
- <AM0PR02MB44508B247E4B6EF4F387DA5FB3A6A@AM0PR02MB4450.eurprd02.prod.outlook.com>
On Thu, Dec 04, 2025 at 03:59:19AM +0000, Skybuck Flying wrote:
[...]
Show 8 quoted lines
> X: > cd X:\Vite\Repository\Mirror > git clone --mirror https://github.com/vitelabs/go-vite . > > cd X:\Vite\Branch\Develop\Delphi > git clone -o Repository "X:\Vite\Repository\Mirror" . > > Now copy the contents of this disk to a new disk... (virtual disks)
Show 5 quoted lines
> git remote -v will show: > > X:\Vite\Repository\Mirror > > In other words the remote is still pointing to the mirror on disk X !!!!
I do not understand the problem: the command
git clone -o Repository "X:\Vite\Repository\Mirror" has cloned the repository "X:\Vite\Repository\Mirror", and so it is completely expected that re so-called "remote" to which you gave the name "Repository" records the URL of the remote repository it points at exactly as it has been provided by the user - with the drive letter in this case.
If you do not want this behavior, you might consider using UNC paths or a reasonably recent (2010s, I think) addition to NTFS called "junction points" which allows you to mount an external drive "on" an empty filesysem folder - almost UNIX-way, so to speak ;-) See the "mountvol" console command and [1].
1. https://serverfault.com/a/8871