본문 바로가기
공부

메모] 윈도우에서 ln -s 심볼릭 링크 사용하기 + 문제해결(심링크)

by 복제고양이 2024. 7. 10.
300x250

git bash 설치할때  심볼릭링크를 활성화했는데도 적용이 안되는 문제가 종종 있었다.

제일 간단한 방법을 찾았다. 당연히 gitconfig의 symlinks가 true여야 한다.

 

윈도우 설정에서 개발자를 검색하고 개발자 기능 사용 > 개발자 모드를 켬으로 활성화한다.

 

 

 

 

 

이후 git clone을 하면 git의 심링크도 적용됨을 확인했다.

 

 

 

아래는 이전에 시도했던 방법들이다.

적용이 될 때도 있고 안될때도 있었다.

============================================================================================

 

 

Git - Downloads (git-scm.com)

 

Git - Downloads

Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific exp

git-scm.com

git bash 다운로드

 

설치시 Enable symbolic links를 체크하기

해당 옵션이 나오지 않고 설치가 바로 진행된다면 취소 후 다시 설치

 

===

옵션을 체크하지 않았다면  

프로그램 파일 > Git > etc 안의 gitconfig에서 

symlinks 를 false에서 true로 변경 후 재부팅

 

 

===

 

 

 

 

예: 바탕화면에 있는 경로 하나를 c드라이브에 심볼릭 링크를 하고 싶을때

 

  • git bash를 관리자 권한으로 실행
  • 경로를 git bash에 맞게 변경 
  • C:\Users\{유저이름}\Desktop\SimpleBlenderStudy -> /c/Users/{유저이름}/Desktop/SimpleBlenderStudy 
  • git bash에 심볼릭 링크 명령어 입력

(예시)

ln -s [원본경로] [심볼릭 링크 경로]

#예시
ln -s /c/Users/{유저이름}/Desktop/SimpleBlenderStudy /c/SimpleBlenderStudy

 

 

---

 

가끔 올바르게 설정했지만 심볼링 링크가 만들어지지 않고 그냥 복사본으로 만들어지는 문제가 있다.

이를 해결하기 위해서는 

 

 

1. git bash를 관리자 권한으로 실행 후 테스트

 

2. 안된다면 로컬 보안 정책 > 로컬 정책 > 사용자 권한 할당 > 심볼 링크 만들기 선택 후 사용할 사용자 계정 추가

 

3. 그래도 안된다면 환경변수를 설정

MSYS winsymlinks:nativestrict

 

 

 

 

바로가기 표시가 있으면 성공

 

 

4. 환경 변수를 설정했음에도 적용이 되지 않을때도 있었다.

그럴때는 git bash를 관리자 권한으로 실행하고

 

export MSYS=winsymlinks:nativestrict

 

 

이 명령어를 입력하니까 해결되었다.

 

 

 

 

 

참고

 

windows - Git Bash shell fails to create symbolic links - Stack Overflow

 

Git Bash shell fails to create symbolic links

When I try to create a symbolic link from the Git Bash shell, it fails every time all the time: ln -s /c/Users/bzisad0/Work testlink Output: ln: creating symbolic link `testlink' to `/c/Users/bzis...

stackoverflow.com

git bash symbolic links on windows · community · Discussion #23591 (github.com)

 

git bash symbolic links on windows · community · Discussion #23591

I did an ln -s file1 file2 in gitbash. when I did an ls -l file2 it did not have an “s” in it. When I did “stat” on each file, there were different inodes. I was wondering whether “ln -s” (symbolic...

github.com

 

 

--

2024 09-10

심볼릭 링크는 (심링크)로도 불린다. 내가 내 블로그에서 검색하려고 했는데 "심링크"로 찾을 수 없어서

아래 글을 추가한다.

 

 

반응형