2

I have a windows 7 host system where I want to use a vagrant VM with the LAMP stack scotch box. The project repository requires symlinks (*) which get changed directly after i clone the repository via ssh.

  • I am cloning the repository (on guest) after connecting via vagrant ssh
  • The repository gets cloned into the shared folder (this seems to be the problem)
  • After that, git status (on guest) says all my symlinks have been modified

I already checked my git configurations and changed it as proposed in answers from this question. Nothing helped.

However, when I clone the repository into an other, not shared VM folder, there are no file changes at all.

So how can I prevent that files change in the shared folder? (i'm afraid removing symlinks is not possible...)

Edit: Example for a changed symlink

git diff script/zend echoes:

diff --git a/script/zend b/script/zend
--- a/script/zend
--- b/script/zend
@@ -1 +0,0 @@
-../source/solar/script/solar
\ No newline at end of file

(*) As symlinks are not allowed by default I changed my vagrant file as explained in this answer.

Community
  • 1
  • 1
csc
  • 607
  • 1
  • 4
  • 15
  • what do you mean they get changed ? what are the differences ? do you have any git hook defined ? – Frederic Henri Dec 11 '15 at 14:50
  • I've added an example in my question. There is no git hook defined. Thanks for help – csc Dec 11 '15 at 15:11
  • I am having this exact same problem. All symlinks inside the repo are being reported as having a single line removed from them and that single line is the symlink destination. – Martin Joiner Jul 06 '16 at 10:41

2 Answers2

0

Is your guest VM Linux? Linux and Windows encode carriage returns differently. DOS uses carriage return and line feed ("\r\n") as a line ending, which Unix uses just line feed ("\n").

paolodm
  • 3
  • 2
0

you're trying to share a directory across different os environments. Each OS handles that differently and will operate on it differently. I suggest you do not try to handle the git repo from both sides through a shared folder

Instead, one way to fix this would be to host a bare repository on the shared folder and clone locally to the VM (and to the windows box). push/pull changes as necessary

from host (git for windows?)

cd shared/folder
mkdir <repo name>.git    #.git isn't really needed but is typical
cd <repo name>.git
git init --bare

cd <current repo location>
git remote add origin <path to repo.git folder>
git push --all

from vm

cd ~
git clone <path to shared folder bare repo.git>

be sure to set the username and email address when on the VM so that the commits are attributed to the correct people (using git config)

g19fanatic
  • 10,567
  • 6
  • 33
  • 63