5

there is a similar question, but the difference here is that I am working on Windows. I am running git on Windows (working in git bash tool) and I have successefully cloned my forked repository. Now I need to make symbolic link and it gives me Permission denied. I can make new dir for example in .git folder and I have also set chmod /R 777 for .git directory, so it seems I have permissions.

I tried to run: rm -rf hooks and then ln -s ../git_hooks hooks.

marc_s
  • 1,007
  • 3
  • 14
  • 24
  • The `ln` command is giving you that error? What is the error **exactly**? What does `ls -la` in your working directory output? – Etan Reisner Jul 28 '15 at 15:18
  • Yes, `ln` is giving me error. Error is `ln: creating symbolic link hooks to ../git_hooks: Permission denied`. List is giving me `drwxr-xr-x 5 User Administ 0 Jul 28 17:24 hooks` - This is the line for `hooks` folder only. – marc_s Jul 28 '15 at 15:27
  • You have a `hooks` directory in your working directory already? – Etan Reisner Jul 28 '15 at 15:32
  • Yes, but from now, when I run the second line (`ln`). – marc_s Jul 28 '15 at 15:36

5 Answers5

6

You might be running into a basic incompatibility of ln on windows platforms (in this case within MINGW-MSYS). You can replace ln with a version that "does the right thing" on Windows; have a look at this:

Git Bash Shell fails to create symbolic links

Community
  • 1
  • 1
Rubin Simons
  • 1,556
  • 1
  • 13
  • 20
5

I had this issue on Windows and I did a couple of steps to resolve this :

  1. Enabled core.symlinks by modifying git config

    git config --edit

  2. Opened Git Bash as an Administrator and executed the git checkout command

This worked for me, hope it helps someone.

Hari
  • 219
  • 4
  • 8
  • 3
    This is the answer that worked for me. The key part was running git as an Adminstrator, as I already had core.symlinks enabled – James Kerslake Oct 19 '21 at 07:47
  • Running Git Bash as Administrator did it for me. There was no mention of `symlinks` in my git config. – Dženan Nov 09 '21 at 22:18
0

If you have are using Git for Windows SDK, you can install winln using the pacman package manager by running: pacman -Su winln

Then you can run: winln -s target link, it will check that you have SeCreateSymbolicLinkPrivilege, otherwise it will fail. This is equivalent to running Window's mklink.exe.

I am surprise Git for Windows, does not ship with winln vs an ln command that does a copy without telling you that it did a copy.

N. Ngo
  • 646
  • 5
  • 6
0

When installing git-bash for windows, there is an option called "Enable symbolic links". When I installed git-bash with that option I had the same issue as OP. So I installed the same setup (git-bash) again with that "Enable symbolic links" option unchecked. Then my issue was resolved.

kmchmk
  • 592
  • 9
  • 16
0

If you are using a local web server on Windows (OpenServer, Laragon, Local), then start the server as an administrator. It worked for me

Temyk
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 14 '21 at 08:48