Monday, October 19, 2015

Git push to multiple remote host (HTPPS)

Peace be upon you,
Some of my project need to have multiple remote repository git hosting. Well, I figure out how to push to multiple remote host by adding the SSH access or HTTPS url. So I pasted my git bash command so you guys can studies the command. In this example, i use bitbucket as my primary repo and gitlab as backup repo. Check it out...

$ git remote -v
origin https:[email protected]/danish/my-project.git (fetch)
origin https:[email protected]/danish/my-project.git (push)

$ git remote set-url --add --push origin https:[email protected]/danish/my-project.git
$ git remote set-url --add --push origin https:[email protected]/danish/my-project.git

$ git remote -v
origin https:[email protected]/danish/my-project.git (fetch)
origin https:[email protected]/danish/my-project.git (push)
origin https:[email protected]/danish/my-project.git (push)

$ git push origin master
Counting objects: 2, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1/1), done.
Writing objects: 100% (2/2), 232 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 1 (delta 1)
To https:[email protected]/danish/my-project.git
   42c6244..791ced9  master -> master

Counting objects: 2, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1/1), done.
Writing objects: 100% (2/2), 232 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 1 (delta 1)
To https:[email protected]/danish/my-project.git
   42c6244..791ced9  master -> master

Do you understand from here? Sorry, I'm to busy this month. I hope you can learn from this example.. Wassalam ~

No comments:

Post a Comment