简体   繁体   中英

Cloning a repository with Linux symlinks on Windows

I have the following setup :

  • a PC running Windows 8 64x
  • Virtualbox 4.3.12
  • Vagrant 1.6.3
  • A virtual machine running Debian 64x

From my virtual machine, on a folder shared with the host, I try to clone repository containing Linux symlinks :

vagrant@vagrant:/vagrant$ git clone https://github.com/francetv/puppet-cron

... Resolving deltas: 100% (162/162), done.

Without doing anything else, I end up with the following diff: the file /.travis.yml is supposed to be a symlink pointing on /.travis/travis.yml.

vagrant@vagrant:/vagrant$ cd puppet-cron

vagrant@vagrant:/vagrant$ git diff

diff --git a/.travis.yml b/.travis.yml

--- a/.travis.yml

+++ b/.travis.yml

@@ -1 +0,0 @@

-.travis/travis.yml

\\ No newline at end of file

I actually encounter this issue when trying to provision the Vagrant box, which causes the provisioning to fail.

My question is: is there any way to avoid this diff right after cloning the repository?

Short answer: No. Virtualbox does not really know what do do with symlinks because they don't exist on Windows.

Long answer: Checking out the repository on your host should help. git knows better how to handle this. You can also try using Samba or rsync instead of the shared folders that come with Virtualbox.

what I did once (which is really not a nice solutions but works) was to set up a repository inside the vm (not a shared folder) and checked out the same repository on my host and added it as a shared folder, than had script running every sec which copied stuff from the shared folder into the guest folder. As said, it worked but was "slow" and broke at occasions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM