git: clone from public github to private github
(dupe note) Not related to pull/push from multiple remote locations; I don't need multiple locations, just to interact between an internal and public github. (end note)
I'm looking for a workflow:
- clone a repo from github.com to an internal github server (not a private repo on github.com)
- make changes and test using internal github server
- potentially pull changes from external github to our internal github
- review changes, send pull request to original github repo
What git incantations will perform these three interactions?
- clone from public to internal github
- pull changes from public to internal github
- push changes from internal to public github
Most of your management between the the two Git servers will be managing separate remotes between them.
If you are explicit with your push's and pull's you can define a workflow that should be pretty sane.
clone from public to internal github
# this will be a one-time setup # first clone the public repo cd /dir/where/you/want/your/repo git clone <public github url> myRepo cd myRepo # create a remote to your internal Git server git remote add internal <internal repo url> # push to your internal repo # (assuming you are working on the master branch) git push internal master # now you have effectively "cloned" the public repo # to your internal server
pull changes from public to internal github
# assuming you are on master branch # and _not_ taking tracking branches # into account (since IMO they complicate matters) git checkout master # pull from github git pull origin master # push to internal git push internal master
push changes from internal to public github
git checkout master git pull internal master git push origin master