Dion S. Jensen
Dion S. Jensen

Reputation: 177

Symlinks not recognized when pulled from git

I have a project in git, which when I symlinks down from git the first time, the symlinks do not work. From all I can see they are properly made symlinks. If I remove the symlinks and recreate them myself, git also sees them as Identical to the ones it has.

Is there a setting in Linux or Git that would prevent symlinks from working if they came form git?

The command used to create the symlinks:

ln -s /absolute/path/to/dest symlink-name

Some additional information

Using ls -lah lists the symlinks as regular files:

-rw-rw-r--.  1 vagrant vagrant   28 Nov 13 09:01 dep
-rw-rw-r--.  1 vagrant vagrant   28 Nov 13 09:01 drupal
-rw-rw-r--.  1 vagrant vagrant   20 Nov 13 09:01 drush
-rw-rw-r--.  1 vagrant vagrant   32 Nov 13 09:01 drush.complete.sh
-rw-rw-r--.  1 vagrant vagrant   29 Nov 13 09:01 drush.launcher
-rw-rw-r--.  1 vagrant vagrant   24 Nov 13 09:01 drush.php
-rw-rw-r--.  1 vagrant vagrant   33 Nov 13 09:01 php-parse
-rw-rw-r--.  1 vagrant vagrant   26 Nov 13 09:01 phpunit
-rw-rw-r--.  1 vagrant vagrant   22 Nov 13 09:01 psysh

Whereas, if I manually remove and recreate the dep symlink, it shows up correctly. Git still sees this as identical and no changes were made.

lrwxrwxrwx.  1 vagrant vagrant   28 Nov 13 09:33 dep -> ../deployer/deployer/bin/dep

Changing the permissions form -rw-rw-r-- to lrwxrwxrwx on the broken symlinks, does not fix them either.

Any help is greatly appreciated.

Upvotes: 2

Views: 2047

Answers (1)

Edward Thomson
Edward Thomson

Reputation: 78673

One of your configuration files has turned off the core.symlinks setting. To find out where this was set, run:

for location in global system local; do
    git config -l --$location |& grep -q symlinks && echo $location
done

This will output whether it is set in the global, system or local location.

The global location is typically $HOME/.gitconfig, the system location is typically /etc/gitconfig, and the local location is typically .git/config in the current repository.

Remove that line and Git should be able to create symlinks properly.

Upvotes: 2

Related Questions