2017-11-25 11 views
0

.repo의 매니페스트 파일에서 다음 줄을 보았습니다. manifest.xml에서 git 명령을 사용하여 동일한 작업을 수행하려면 어떻게해야합니까? 특정 개정 및 깊이 = 1로 'git clone'을 실행하는 방법을 알고 싶습니다.특정 수정 버전과 깊이 = 1을 가진 복제본을 만드는 방법

<project clone-depth="1" groups="pdk-cw-fs,pdk-fs" name="repository name" path="repository path" revision="SHA1"/> 

답변

2

revision 분기 (refs/heads/xxx) 또는 태그 (refs/tags/xxx)이면,

git clone $remote -b $revision --depth=1 --single-branch 
#or 
git fetch $remote $revision --depth=1 && git checkout FETCH_HEAD 

revision 특정 경우

커밋 또는 다른 namepaces하지 refs/tags/ 또는 refs/heads/ 아래 REF,

git fetch $remote $revision --depth=1 && git checkout FETCH_HEAD 

revision이 참조가없는 특정 커밋 인 경우 ing, git fetcherror: Server does not allow request for unadvertised object으로 인해 실패합니다. git config 또는 호스팅 서비스 구성의 변수는 승인되지 않은 개체를 가져올 수 있습니다.

+0

나를 위해 작동하지 않습니다. 샘플 저장소로 https://github.com/hyde1004/test1.git를 사용했습니다. 내가 실행했을 때 'git fetch https://github.com/hyde1004/test1.git 6e82b0b --depth = 1'을 실행했을 때 이 표시되었습니다. "치명적인 오류 : Git 저장소가 아니거나 상위 디렉토리 중 하나입니다. .git" . 내가 를 실행할 때 '자식 초기화 & & 자식 https://github.com/hyde1004/test1.git 6e82b0b --depth = 1' 가'치명적인 을 표시 가져 오기 : 원격 심판 6e82b0b' – user3381542

+0

을 찾을 수 없습니다를 @ user3381542 그러면 원격 저장소는 ref없이 단일 커밋을 가져올 수 없습니다. Gerrit에서 진행되는 프로젝트가 있습니까? – ElpieKay

+0

마지막으로 우분투 14.04에서 git을 1.9.1에서 2.15.0으로 업데이트 한 후 저장소를 가져올 수 있습니다. – user3381542