-
[Git] Fork한 Public Repo를 Private Repo으로 바꾸기기타 2023. 8. 11. 16:26
Git에서는 Fork한 Repository(Repo)의 경우 Public Repo로 관리하게 강제하고 있다. 하지만, private하게 진행시키고 싶은 프로젝트의 경우 public repo로 git을 관리하기 어려운 경우가 있다. 이 때, Fork한 public repo를 mirror하여 private repo로 관리하는 방법은 다음과 같다.
1. Prep
- 원하는 Repo를 fork해오기 (public-repo.git)
- private 하게 관리할 빈 repo를 만들기 (private-repo.git)
2. Mirror
git clone --bare https://github.com/exampleuser/public-repo.git cd public-repo.git git push --mirror https://github.com/exampleuser/private-repo.git cd .. rm -rf public-repo.git3. Clone private-repo.git
git clone https://github.com/exampleuser/private-repo.git이후 git 관리는 private-repo에 대해 동일하게 진행하면 된다.
4. Update private-repo.git
public repo의 수정사항을 private repo에 업데이트시키고 싶을 때, 아래와 같이 진행해주면 된다.
cd private-repo.git git remote add public https://github.com/exampleuser/public-repo.git git pull public master git push origin master참조:
https://stackoverflow.com/questions/10065526/github-how-to-make-a-fork-of-public-repository-private
GitHub: How to make a fork of public repository private?
How can I fork a public repository, but make my fork private? I do have the subscription to support private repositories.
stackoverflow.com