프로세스가 거의 완벽합니다. 유일한 것은 초기 클론에서 누락 된 --mirror
매개 변수입니다. 지금 올바른 REPO입니다 REPO 프로젝트에있는 모든 사람에게 명확하지 않을 것이기 때문에
# create the private repo
ssh private-server
mkdir -p /path/to/shared/repos
git init --shared={whatever makes sense for your environment} /path/to/shared/repos/internalrepo.git
exit
# go to github.com and make the public repo readonly
# create a local mirror
git clone --bare --mirror $Github-URL github.git
# now the local repo github.git contains all the stuff from the github repo
cd github.git
git push --mirror $Private-URL
# Tell all developers to execute `git remote set-url origin $Private-URL`
# Done
나는, 변화 열어 github에의 REPO을 떠나지 않을 것입니다.
당신은 또한 사용할 수 있습니다 당신은 서버 REPO (cron 작업처럼) 정기적으로 다음
ssh private-server
cd /path/to/shared/repos/internalrepo.git
git remote add --mirror github $Github-URL
및
git fetch github # get new commits from github
git remote prune github # drop branches, which are now deleted in the github repo
편집에 실행하면 당신은 아직도 그것을 할 수 있습니다 교환을 할 로컬 미러. 그러나 git는 삭제 된 브랜치를 어떻게 처리 할 지 결정할 수 없으며 분기 된 브랜치를 어떻게 처리할지 결정할 수 없기 때문에 쉬운 자동화 된 프로세스가 없습니다. 소위 github-repo에서 정기적으로 물건을 가져오고, 내부 저장소에서 물건을 가져오고, 분기 기록을 해결하고,이 물건을 내부 저장소로 밀어 넣을 수있는 작업 저장소를 유지해야합니다.
추가 정보 : "local-github-url"은 진정한 기스 탑입니다. 개인용 Github Enterprise 서비스입니다. 사적인 Github에 대한 쉘 또는 crontab 액세스 권한이 없습니다. – Mojo