Is it possible to fork a public GitHub repo into an enterprise repository?

后端 未结 4 853
离开以前
离开以前 2020-12-23 12:36

There exist a public repo for Quick framework here. I\'d like to be able to fork this into a private enterprise GitHub repository. Forking would allow all the branches to r

4条回答
  •  春和景丽
    2020-12-23 13:07

    While it isn't possible to fork from the public GitHub directly to your Enterprise installation, you can fork it on the public GitHub and then mirror that forked repository on your enterprise installation.

    Steps

    1. Create an empty repository on your enterprise GitHub:
      curl https://github.yourenterprise.com/api/v3/user/repos \
        -u "yourUsername" \
        -d "{\"name\": \"whatever-repository\", \"private\": true }"
      
    2. Create a bare clone of your fork
      git clone --bare https://github.com/publicGitHubUser/forked-repository.git
      
    3. Change directories so you are inside the bare clones folder:
      cd ./whatever-repository.git/
      
    4. Push the repository with the --mirror flag to your enterprise GitHub
      git push --mirror https://github.yourenterprise.com/enterpriseGitHubUser/forked-repository.git
      

    More Information

    https://help.github.com/articles/duplicating-a-repository/

提交回复
热议问题