HTTPS를 사용하여 저장소 복제하는 방법
팁
HTTPS 복제는 Cursor에서 Git 저장소를 시작하는 안전하고 쉬운 방법입니다.
기본 HTTPS 복제
명령 팔레트 사용
- 명령 팔레트 열기(Ctrl/Cmd + Shift + P)
- "Git: Clone" 입력
- 저장소 URL 입력
- 대상 폴더 선택
터미널 사용
# 기본 복제 명령
git clone https://github.com/username/repository.git
# 특정 폴더에 복제
git clone https://github.com/username/repository.git 내-프로젝트
인증 방법
1. 개인 액세스 토큰
- GitHub
- GitLab
# URL에 토큰 사용
git clone https://username:[email protected]/username/repository.git
# 또는 자격 증명 구성
git config --global credential.helper store
# URL에 토큰 사용
git clone https://oauth2:[email protected]/username/repository.git
# 또는 자격 증명 관리자에 저장
git config --global credential.helper cache
2. 자격 증명 관리자
# Windows
git config --global credential.helper wincred
# macOS
git config --global credential.helper osxkeychain
# Linux
git config --global credential.helper cache
고급 복제 옵션
1. 얕은 복제
# 제한된 기록으로 복제
git clone --depth 1 https://github.com/username/repository.git
# 특정 브랜치 복제
git clone --branch main --depth 1 https://github.com/username/repository.git
2. 스파스 체크아웃
# 저장소 초기화
git clone --no-checkout https://github.com/username/repository.git
cd repository
# 스파스 체크아웃 구성
git sparse-checkout init
git sparse-checkout set folder1 folder2
git checkout main
일반적인 문제
1. 인증 실패
# 저장된 자격 증명 확인
git config --list | grep credential
# 저장된 자격 증명 지우기
git config --global --unset credential.helper
2. SSL 인증서 문제
# SSL 확인
git config --global http.sslVerify true
# 확인 건너뛰기(권장하지 않음)
git config --global http.sslVerify false
3. 프록시 설정
# 프록시 구성
git config --global http.proxy http://proxy.example.com:8080
# 프록시 제거
git config --global --unset http.proxy
모범 사례
1. 보안
# 자격 증명 관리자 사용
git config --global credential.helper manager
# SSL 확인 활성화
git config --global http.sslVerify true
2. 성능
# 압축 구성
git config --global core.compression 9
# 병렬 전송 활성화
git config --global core.parallel 0
3. 조직
# 표준 디렉토리 생성
mkdir ~/Projects
cd ~/Projects
# 일관된 이름으로 복제
git clone https://github.com/org/project.git org-project
여러 원격 저장소 작업
1. 원격 저장소 추가
# 추가 원격 저장소 추가
git remote add upstream https://github.com/original/repository.git
# 원격 저장소 확인
git remote -v
2. 업데이트 가져오기
# 모든 원격 저장소에서 가져오기
git fetch --all
# 특정 원격 저장소에서 가져오기
git fetch upstream