{"id":9912,"date":"2023-03-05T19:06:17","date_gmt":"2023-03-05T19:06:17","guid":{"rendered":"https:\/\/putridparrot.com\/blog\/?p=9912"},"modified":"2023-03-05T19:06:17","modified_gmt":"2023-03-05T19:06:17","slug":"changing-the-origin-of-your-local-git-repo","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/changing-the-origin-of-your-local-git-repo\/","title":{"rendered":"Changing the origin of your local git repo."},"content":{"rendered":"<p>Git, being a distributed source control system, allows us to switch the remote\/origin for the push or fetch of our local repository. Or to put it another way&#8230;<\/p>\n<p>We&#8217;ve just moved from one remote git repository to another, how do we update our local code base to &#8220;retarget&#8221; to the new location?<\/p>\n<p>When you&#8217;re using GitHub, GitLab, bitbucket etc. you might come to a point where you migrate from one server to another. Ofcourse you can simply clone your repo. again from the new server OR you can just target you fetch\/push origin to the new location like this&#8230;<\/p>\n<p>To check your current remote\/origin, just run<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ngit remote -v\r\n<\/pre>\n<p>Now if you wish to change the remote\/origin, simply use<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ngit remote set-url remote_name remote_url\r\n<\/pre>\n<p>Where remote_name might be <em>origin<\/em> and the remote_url is the new .git URL of your server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git, being a distributed source control system, allows us to switch the remote\/origin for the push or fetch of our local repository. Or to put it another way&#8230; We&#8217;ve just moved from one remote git repository to another, how do we update our local code base to &#8220;retarget&#8221; to the new location? When you&#8217;re using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[206],"tags":[],"class_list":["post-9912","post","type-post","status-publish","format-standard","hentry","category-git-2"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=9912"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9912\/revisions"}],"predecessor-version":[{"id":9917,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9912\/revisions\/9917"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=9912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=9912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=9912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}