1

(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
Community
  • 1
  • 1
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
  • Possible duplicate of [pull/push from multiple remote locations](http://stackoverflow.com/questions/849308/pull-push-from-multiple-remote-locations) – Ritave Mar 21 '16 at 17:12

1 Answers1

3

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
Jonathan.Brink
  • 23,757
  • 20
  • 73
  • 115