{"id":2393,"date":"2017-07-02T19:43:45","date_gmt":"2017-07-02T14:43:45","guid":{"rendered":"https:\/\/ahmadawais.com\/?p=2393"},"modified":"2017-07-02T19:49:58","modified_gmt":"2017-07-02T14:49:58","slug":"how-to-use-bitbucket-and-github-at-the-same-time-for-one-project","status":"publish","type":"post","link":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/","title":{"rendered":"How to Use BitBucket and GitHub at the Same Time for One Project?"},"content":{"rendered":"<p>I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it.<\/p>\n<p>A few <strong>EASY<\/strong> solutions.<\/p>\n<h3 id=\"%e2%9a%a1%ef%b8%8f-method-1-multiple-remotes-pushed-and-fetched-independently\">\u26a1\ufe0f\u00a0Method #1: Multiple Remotes Pushed (And Fetched) Independently<a href=\"#%e2%9a%a1%ef%b8%8f-method-1-multiple-remotes-pushed-and-fetched-independently\" class=\"heading-link\">#<\/a><\/h3>\n<p>This is the easiest to get your head around, but the most effort to maintain.<\/p>\n<p>We start out by adding our new remote:<\/p>\n<\/section>\n<div class=\"postcontents full dark\">\n<div class=\"wrapper\">\n<pre><code>$ cd myproject\r\n$ git remote add bitbucket ssh:\/\/git@bitbucket.org\/user\/myproject.git\r\n$ git push bitbucket master\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<section class=\"postcontents wrapper\">\n<p>Straight forward no? Except of course every time we commit any changes, we need to push to both our original \u201corigin\u201d and our new remote \u201cbitbucket\u201d:<\/p>\n<\/section>\n<div class=\"postcontents full dark\">\n<div class=\"wrapper\">\n<pre><code>$ git push origin master\r\n$ git push bitbucket master\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<section class=\"postcontents wrapper\">\n<p>Not a massive overhead, but I\u2019m sure it will grate over time. Or you can create an alias <code>alias gpob=\"git push origin master &amp;&amp; git push bitbucket master\"<\/code>. That goes in your bash or zsh profile.<\/p>\n<h3 id=\"%e2%9a%a1%ef%b8%8f-method-2-single-remote-with-multiple-urls-pushed-and-fetched-consecutively\">\u26a1\ufe0f\u00a0Method #2: Single Remote With Multiple URLs Pushed (And Fetched) Consecutively<a href=\"#%e2%9a%a1%ef%b8%8f-method-2-single-remote-with-multiple-urls-pushed-and-fetched-consecutively\" class=\"heading-link\">#<\/a><\/h3>\n<p>With this method, we are going to add an additional URL to our existing remote \u201corigin\u201d:<\/p>\n<\/section>\n<div class=\"postcontents full dark\">\n<div class=\"wrapper\">\n<pre><code>$ cd myproject\r\n$ git remote set-url --add origin ssh:\/\/git@bitbucket.org\/user\/myproject.git\r\n$ git push origin master\r\nEverything up-to-date\r\nEverything up-to-date\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<section class=\"postcontents wrapper\">\nMuch less effort!<\/p>\n<p>Of course silver lining has a cloud, and in this case, it is that while we can push to multiple URLs simultaneously, we can only fetch from the original <code>origin<\/code> (you can change this, but that is out of scope for this post).<\/p>\n<p>Finally, to see which remote will be fetched from:<\/p>\n<\/section>\n<div class=\"postcontents full dark\">\n<div class=\"wrapper\">\n<code>$ git remote -v show<\/code>\n<\/div>\n<\/div>\n<section class=\"postcontents wrapper\">\nHappy hacking!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it. A few EASY solutions. \u26a1\ufe0f\u00a0Method #1: Multiple Remotes Pushed (And Fetched) Independently# This is the easiest to get your head around, but the most effort to maintain. We start out by adding our new remote: Straight forward no? Except of course every time we commit any changes, we need to push to both our original \u201corigin\u201d and our new remote \u201cbitbucket\u201d: Not a massive overhead, but I\u2019m sure it will [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"webmentions_disabled_pings":false,"webmentions_disabled":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[141],"tags":[154,155],"class_list":["post-2393","post","type-post","status-publish","format-standard","hentry","category-devops","tag-git","tag-git-multiple-remotes"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Use BitBucket and GitHub at the Same Time for One Project?<\/title>\n<meta name=\"description\" content=\"I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it. A few\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use BitBucket and GitHub at the Same Time for One Project?\" \/>\n<meta property=\"og:description\" content=\"I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it. A few\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/\" \/>\n<meta property=\"og:site_name\" content=\"Ahmad Awais\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/AhmadAwais\" \/>\n<meta property=\"article:author\" content=\"https:\/\/facebook.com\/AhmadAwais\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-02T14:43:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-07-02T14:49:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ahmadawais.com\/wp-content\/uploads\/2024\/08\/ahmad-awais.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1440\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ahmad Awais\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@MrAhmadAwais\" \/>\n<meta name=\"twitter:site\" content=\"@MrAhmadAwais\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ahmad Awais\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/\"},\"author\":{\"name\":\"Ahmad Awais\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\"},\"headline\":\"How to Use BitBucket and GitHub at the Same Time for One Project?\",\"datePublished\":\"2017-07-02T14:43:45+00:00\",\"dateModified\":\"2017-07-02T14:49:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/\"},\"wordCount\":228,\"commentCount\":12,\"publisher\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\"},\"keywords\":[\"git\",\"git multiple remotes\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/\",\"url\":\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/\",\"name\":\"How to Use BitBucket and GitHub at the Same Time for One Project?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#website\"},\"datePublished\":\"2017-07-02T14:43:45+00:00\",\"dateModified\":\"2017-07-02T14:49:58+00:00\",\"description\":\"I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it. A few\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ahmadawais.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use BitBucket and GitHub at the Same Time for One Project?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#website\",\"url\":\"https:\\\/\\\/ahmadawais.com\\\/\",\"name\":\"Ahmad Awais\",\"description\":\"Founder &amp; CEO of CommandCode.ai f\\\/k\\\/a Langbase | Google Developers Advisory Board (gDAB) founding member\",\"publisher\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ahmadawais.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\",\"name\":\"Ahmad Awais\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\",\"url\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\",\"contentUrl\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\",\"width\":2299,\"height\":1705,\"caption\":\"Ahmad Awais\"},\"logo\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\"},\"description\":\"Founder & CEO of \u2318 Command Code coding agent with taste. Founded Langbase.com, AI cloud to build, deploy, and scale AI agents with tools & memory \u00b7 Creator of Command.new. \\\"Awais is an awesome example for developers\\\" \u2014 Satya Nadella, CEO of Microsoft. NASA Mars Ingenuity Helicopter mission code contributor 8th GitHub Stars Award recipient with 5x GitHub Stars Award (Listed as GitHub's #1 JavaScript trending developer). Google Developers Expert Web DevRel. Ex VP Eng (DevTools & DevRel) Rapid \u00b7 Google Developers Advisory Board (gDAB) founding member \u00b7 AI\\\/ML\\\/DevTools Angel Investor (Replit, Resend, Daytona, Gumroad and you?) \u276f AI\\\/ML Advisory Board San Francisco, DevNetwork. Award-winning Open Source Engineering leader authored hundreds of open-source dev-tools and software libraries used by millions of developers, including Shades of Purple code theme and corona-cli. Linux Foundation (Node.js Committee Lead), OpenAPI Business Governing Board. Taught 108K+ developers via NodeCLI.com and VSCode.pro course. 274 million views, blogging for 24 yrs. \u276f Read more about Ahmad Awais or come say hi on \ud835\udd4f @MrAhmadAwais.\",\"sameAs\":[\"https:\\\/\\\/AhmadAwais.com\\\/\",\"https:\\\/\\\/facebook.com\\\/AhmadAwais\",\"https:\\\/\\\/instagram.com\\\/MrAhmadAwais\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/MrAhmadAwais\\\/\",\"https:\\\/\\\/x.com\\\/MrAhmadAwais\",\"https:\\\/\\\/youtube.com\\\/AhmadAwais\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use BitBucket and GitHub at the Same Time for One Project?","description":"I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it. A few","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/","og_locale":"en_US","og_type":"article","og_title":"How to Use BitBucket and GitHub at the Same Time for One Project?","og_description":"I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it. A few","og_url":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/","og_site_name":"Ahmad Awais","article_publisher":"https:\/\/facebook.com\/AhmadAwais","article_author":"https:\/\/facebook.com\/AhmadAwais","article_published_time":"2017-07-02T14:43:45+00:00","article_modified_time":"2017-07-02T14:49:58+00:00","og_image":[{"width":2560,"height":1440,"url":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2024\/08\/ahmad-awais.jpg","type":"image\/jpeg"}],"author":"Ahmad Awais","twitter_card":"summary_large_image","twitter_creator":"@MrAhmadAwais","twitter_site":"@MrAhmadAwais","twitter_misc":{"Written by":"Ahmad Awais","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/#article","isPartOf":{"@id":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/"},"author":{"name":"Ahmad Awais","@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b"},"headline":"How to Use BitBucket and GitHub at the Same Time for One Project?","datePublished":"2017-07-02T14:43:45+00:00","dateModified":"2017-07-02T14:49:58+00:00","mainEntityOfPage":{"@id":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/"},"wordCount":228,"commentCount":12,"publisher":{"@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b"},"keywords":["git","git multiple remotes"],"articleSection":["DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/","url":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/","name":"How to Use BitBucket and GitHub at the Same Time for One Project?","isPartOf":{"@id":"https:\/\/ahmadawais.com\/#website"},"datePublished":"2017-07-02T14:43:45+00:00","dateModified":"2017-07-02T14:49:58+00:00","description":"I had a repository for which I needed the remote to be hosted both at BitBucket and GitHub. So, I figured out a few easy solutions to deal with it. A few","breadcrumb":{"@id":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ahmadawais.com\/how-to-use-bitbucket-and-github-at-the-same-time-for-one-project\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ahmadawais.com\/"},{"@type":"ListItem","position":2,"name":"How to Use BitBucket and GitHub at the Same Time for One Project?"}]},{"@type":"WebSite","@id":"https:\/\/ahmadawais.com\/#website","url":"https:\/\/ahmadawais.com\/","name":"Ahmad Awais","description":"Founder &amp; CEO of CommandCode.ai f\/k\/a Langbase | Google Developers Advisory Board (gDAB) founding member","publisher":{"@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ahmadawais.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b","name":"Ahmad Awais","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg","url":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg","contentUrl":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg","width":2299,"height":1705,"caption":"Ahmad Awais"},"logo":{"@id":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg"},"description":"Founder & CEO of \u2318 Command Code coding agent with taste. Founded Langbase.com, AI cloud to build, deploy, and scale AI agents with tools & memory \u00b7 Creator of Command.new. \"Awais is an awesome example for developers\" \u2014 Satya Nadella, CEO of Microsoft. NASA Mars Ingenuity Helicopter mission code contributor 8th GitHub Stars Award recipient with 5x GitHub Stars Award (Listed as GitHub's #1 JavaScript trending developer). Google Developers Expert Web DevRel. Ex VP Eng (DevTools & DevRel) Rapid \u00b7 Google Developers Advisory Board (gDAB) founding member \u00b7 AI\/ML\/DevTools Angel Investor (Replit, Resend, Daytona, Gumroad and you?) \u276f AI\/ML Advisory Board San Francisco, DevNetwork. Award-winning Open Source Engineering leader authored hundreds of open-source dev-tools and software libraries used by millions of developers, including Shades of Purple code theme and corona-cli. Linux Foundation (Node.js Committee Lead), OpenAPI Business Governing Board. Taught 108K+ developers via NodeCLI.com and VSCode.pro course. 274 million views, blogging for 24 yrs. \u276f Read more about Ahmad Awais or come say hi on \ud835\udd4f @MrAhmadAwais.","sameAs":["https:\/\/AhmadAwais.com\/","https:\/\/facebook.com\/AhmadAwais","https:\/\/instagram.com\/MrAhmadAwais\/","https:\/\/www.linkedin.com\/in\/MrAhmadAwais\/","https:\/\/x.com\/MrAhmadAwais","https:\/\/youtube.com\/AhmadAwais"]}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/posts\/2393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/comments?post=2393"}],"version-history":[{"count":0,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/posts\/2393\/revisions"}],"wp:attachment":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/media?parent=2393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/categories?post=2393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/tags?post=2393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}