{"id":29380,"date":"2021-02-26T10:16:48","date_gmt":"2021-02-26T18:16:48","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=29380"},"modified":"2023-12-01T04:09:00","modified_gmt":"2023-12-01T12:09:00","slug":"git-fatal-remote-origin-already-exists","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/","title":{"rendered":"Git fatal: remote origin already exists Solution"},"content":{"rendered":"\n<p>The \u201corigin\u201d keyword is commonly used to describe the central source of a Git repository. If you try to add a remote called \u201corigin\u201d that already exists, you will encounter the \u201cfatal: remote origin already exists\u201d error.<br><\/p>\n\n\n\n<p>In this guide, we discuss the cause of and the solution to the <code>fatal: remote origin already exists<\/code>, with reference to an example. Let\u2019s get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">fatal: remote origin already exists<\/h2>\n\n\n\n<p>The Git <code>fatal: remote origin already exists<\/code> error indicates you are trying to create a remote with the name \u201corigin\u201d when a remote with this name already exists. This error is common if you have forgotten to set up a repository and are following setup instructions again. You may also see this error if you try to change the URL of the \u201corigin\u201d remote repository by using the git remote add command.<br><\/p>\n\n\n\n<p>To solve this error, you should first check if the current remote associated with the \u201corigin\u201d keyword has the correct URL. You can do this using the git remote -v command:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git remote -v<\/pre><\/div>\n\n\n\n<p>You will see a list formatted like this:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>origin    https:\/\/github.com\/career_karma_tutorials\/git (fetch)\norigin    https:\/\/github.com\/career_karma_tutorials\/git (push)<\/pre><\/div>\n\n\n\n<p>If the \u201corigin\u201d URL does not match the URL of your remote repository to which you want to refer, you can change the remote URL. Alternatively, you can remove the remote and set a new remote URL with the name \u201corigin\u201d.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">An Example Scenario<\/h2>\n\n\n\n<p>We have a repository called \u201cgit\u201d and we want to change the origin from:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>https:\/\/github.com\/career_karma_tutorials\/git<\/pre><\/div>\n\n\n\n<p>The new origin should use the URL:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>https:\/\/github.com\/career_karma_tutorials\/git_tutorials<\/pre><\/div>\n\n\n\n<p>To do so, we use the git remote add command, which adds a new remote to a repository:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git remote add origin https:\/\/github.com\/career_karma_tutorials\/git_tutorials<\/pre><\/div>\n\n\n\n<p>This command returns an error:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>fatal: remote origin already exists.<\/pre><\/div>\n\n\n\n<p>Git is telling us that the \u201corigin\u201d remote already exists.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Solution&nbsp;<\/h2>\n\n\n\n<p>We cannot add a new remote using a name that is already in use, even if we specify a new URL for the remote. In this case, we have tried to create a new remote called \u201corigin\u201d even though one exists. To solve the error, we must remove the existing remote called \u201corigin\u201d and add a new one or change the URL of the existing remote.<br><\/p>\n\n\n\n<p>To remove the existing remote and add a new one, we can set a new URL for our remote:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git remote set-url origin https:\/\/github.com\/career_karma_tutorials\/git_tutorials<\/pre><\/div>\n\n\n\n<p>This is the preferred method because we can change the URL associated with our remote in one command. There is no need to remove the old origin and create a new one because the set-url command exists.<br><\/p>\n\n\n\n<p>Alternatively, we can remove our \u201corigin\u201d remote and create a new one with our new URL:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>git remote rm origin\ngit remote add origin https:\/\/github.com\/career_karma_tutorials\/git_tutorials<\/pre><\/div>\n\n\n\n<p>This removes our existing \u201corigin\u201d remote and replaces the remote with a new one called \u201corigin\u201d, using the URL we have specified. But, this method uses two commands instead of the one that we used earlier.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The Git <code>fatal: remote origin already exists<\/code> error is caused by creating a remote called \u201corigin\u201d when one already exists. To fix this error, replace the URL of your existing origin using the git remote set-url command. You can also remove your existing remote called \u201corigin\u201d and replace it with a new one using the git remote add command.<br><\/p>\n\n\n\n<p>Do you want to learn more about coding in Git? Take a look at our <a href=\"https:\/\/careerkarma.com\/blog\/what-is-git\/\">How to Learn Git guide<\/a>. This guide is filled with learning resources to help you build upon your knowledge of Git.<\/p>\n","protected":false},"excerpt":{"rendered":"The \u201corigin\u201d keyword is commonly used to describe the central source of a Git repository. If you try to add a remote called \u201corigin\u201d that already exists, you will encounter the \u201cfatal: remote origin already exists\u201d error. In this guide, we discuss the cause of and the solution to the fatal: remote origin already exists,&hellip;","protected":false},"author":240,"featured_media":13848,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17286],"tags":[],"class_list":{"0":"post-29380","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-git"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Git","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Git fatal: remote origin already exists Solution | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn how to solve the Git &quot;fatal: remote origin already exists&quot; error.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git fatal: remote origin already exists Solution\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn how to solve the Git &quot;fatal: remote origin already exists&quot; error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-26T18:16:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:09:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"681\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Git fatal: remote origin already exists Solution\",\"datePublished\":\"2021-02-26T18:16:48+00:00\",\"dateModified\":\"2023-12-01T12:09:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/\"},\"wordCount\":544,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/\",\"name\":\"Git fatal: remote origin already exists Solution | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"datePublished\":\"2021-02-26T18:16:48+00:00\",\"dateModified\":\"2023-12-01T12:09:00+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn how to solve the Git \\\"fatal: remote origin already exists\\\" error.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg\",\"width\":1020,\"height\":681},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git\",\"item\":\"https:\/\/careerkarma.com\/blog\/git\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Git fatal: remote origin already exists Solution\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Git fatal: remote origin already exists Solution | Career Karma","description":"On Career Karma, learn how to solve the Git \"fatal: remote origin already exists\" error.","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:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/","og_locale":"en_US","og_type":"article","og_title":"Git fatal: remote origin already exists Solution","og_description":"On Career Karma, learn how to solve the Git \"fatal: remote origin already exists\" error.","og_url":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2021-02-26T18:16:48+00:00","article_modified_time":"2023-12-01T12:09:00+00:00","og_image":[{"width":1020,"height":681,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Git fatal: remote origin already exists Solution","datePublished":"2021-02-26T18:16:48+00:00","dateModified":"2023-12-01T12:09:00+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/"},"wordCount":544,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/","url":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/","name":"Git fatal: remote origin already exists Solution | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","datePublished":"2021-02-26T18:16:48+00:00","dateModified":"2023-12-01T12:09:00+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn how to solve the Git \"fatal: remote origin already exists\" error.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/black-and-gray-laptop-computer-turned-on-doing-computer-1181271.jpg","width":1020,"height":681},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/git-fatal-remote-origin-already-exists\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Git","item":"https:\/\/careerkarma.com\/blog\/git\/"},{"@type":"ListItem","position":3,"name":"Git fatal: remote origin already exists Solution"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/29380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=29380"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/29380\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/13848"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=29380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=29380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=29380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}