Re: Cloning into an existing, non-empty directory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Richard Hartmann wrote:

> The only real
> problem left is that I can't clone initially as $HOME is obviously
> non-empty, resulting in
>
>   git --work-tree=$HOME \
>     --git-dir=$HOME/.config/vcsh/repo.d/mr.git \
>     clone <remote> .config/vcsh/repo.d/mr.git
> fatal: working tree '/home/richih' already exists.
>
> This means I am down to cloning, creating the directories I need,
> moving .git and the actual files around, making git aware that tracked
> files were not deleted, just moved, and then finally being able to use
> my repo.

Have you tried something like the following?

	cd $CROWDED_DIRECTORY
	GIT_DIR=/path/to/git/dir
	GIT_WORK_TREE=$(pwd)
	export GIT_DIR GIT_WORK_TREE

	git init
	git remote add origin <remote>
	git pull

Two more caveats for the road. :)

 - git does not track detailed file permissions or secret/non-secret
   status.  Please be careful about ssh private keys and so on.

 - when updating the worktree, git will unlink existing files before
   replacing them and does not fsync the result.  So one should be
   careful when tracking files that will cause major harm if they go
   missing temporarily (though I can't think of any major examples in
   $HOME offhand).

Happy hacking,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]