CompileNix's Blog - Setup git to pull from upstream and push to another remote

Start Page | RSS Feed | Find Stuff

Pull "master" from https://git.compilenix.org/Compilenix/tls-tester.git
Push "gitlab/master" to https://gitlab.com/compilenix/tls-tester.git

Create an empty repo on the server for https://gitlab.com/compilenix/tls-tester.
Create the branch "gitlab/master" on the server for https://gitlab.com/compilenix/tls-tester


git clone https://git.compilenix.org/Compilenix/tls-tester.git
cd tls-tester
git remote add lab https://gitlab.com/compilenix/tls-tester.git
git config remote.pushdefault lab
git config push.default current
git fetch --all
git checkout gitlab/master
git branch --set-upstream-to=origin/master master

now when your current branch is "master" you can "git pull" and get the changes from https://git.compilenix.org/Compilenix/tls-tester.git
"git checkout gitlab/master" to switch to the fork
"git merge master" to merge the new changes into "gitlab/master"
do your thing to merge the new changes from upstream into your fork
"git push", while you are on the "gitlab/master" branch will push it automatically to https://gitlab.com/compilenix/tls-tester.git