{"id":22741,"date":"2020-09-16T18:11:16","date_gmt":"2020-09-17T01:11:16","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=22741"},"modified":"2023-12-01T04:00:07","modified_gmt":"2023-12-01T12:00:07","slug":"git-nothing-added-to-commit-but-untracked-files-present","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/","title":{"rendered":"Git nothing added to commit but untracked files present Solution"},"content":{"rendered":"\n<p>If you add files to your local machine then try to pull a remote copy of a repository without adding those files to the repository, you\u2019ll encounter the \u201cnothing added to commit but untracked files present\u201d <a href=\"https:\/\/careerkarma.com\/blog\/github-profile-readme\/\">Git<\/a> error.<br><\/p>\n\n\n\n<p>This guide discusses what this error means. We\u2019ll walk through two potential solutions to this issue and their benefits and drawbacks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">nothing added to commit but untracked files present<\/h2>\n\n\n\n<p><a href=\"https:\/\/careerkarma.com\/blog\/what-is-git\/\">Git is a distributed version control system<\/a>. This means you can make a local copy of a repository and make your own changes to that repository. These changes are not reflected in the main project until you commit them.<br><\/p>\n\n\n\n<p>When you pull code from a remote server, make sure that all the files on your local machine are part of the Git staging area, or part of a commit. This is because Git needs to know what files are part of a repository.<br><\/p>\n\n\n\n<p>Executing a <a href=\"https:\/\/careerkarma.com\/blog\/git-pull\/\">git pull command<\/a> on a repository where you have not added every file to the staging area or a commit will result in the following error:<br><\/p>\n\n\n\n<p>nothing added to commit but untracked files present<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Untracked Files: A Primer<\/h2>\n\n\n\n<p>Untracked files are files inside a project that have been configured with Git, but have not become part of the Git repository.<br><\/p>\n\n\n\n<p>Files only become part of a Git repository if you add them using the \u201cgit add\u201d command. This lets you create and modify files in your local machine that do not have to become part of a line of development in a repository.<br><\/p>\n\n\n\n<p>Untracked files should either be added to a project, or ignored using a rule in a .gitignore file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Solution<\/h2>\n\n\n\n<p>There are two potential solutions to this error.<br><\/p>\n\n\n\n<p>The first solution is to add all the untracked files into a Git repository. Do this using the <a href=\"https:\/\/careerkarma.com\/blog\/git-add\/\">git add command<\/a>:<br><\/p>\n\n\n\n<p><code>git add file_to_add.md<br><\/code><\/p>\n\n\n\n<p>This will move the file into the staging area. When you add a file to the staging area, it becomes tracked. This is because all files in the staging area are added to the next commit you create, unless they are removed. Git needs to track these files to know to add them to a commit.<br><\/p>\n\n\n\n<p>The second option is to ignore the files you have added to your repository. This option is best taken if you do not want the files you have created to become part of the Git repository. This is common for configuration files that store API keys or local dependency storage folders.<br><\/p>\n\n\n\n<p>You can ignore files by <a href=\"https:\/\/careerkarma.com\/blog\/gitignore\/\">adding an entry to the .gitignore file<\/a> in your project:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>file_to_add.md\ndirectory\/\n<\/pre><\/div>\n\n\n\n<p>You can place a gitignore file in any directory in your project. It\u2019s best to keep your .gitignore in the root folder of your repository so that it is easy to access. All the rules in a .gitignore file will recursively apply to the files and folders within the folder in which the .gitignore file is stored.<br><\/p>\n\n\n\n<p>Now that we\u2019ve solved the error, we can pull the most recent version of a Git repository using the git pull command:<br><\/p>\n\n\n\n<p><code>git pull<br><\/code><\/p>\n\n\n\n<p>This command should succeed because we are now tracking or ignoring all the files that are in the project folder.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The \u201c<code>nothing added to commit but untracked files present<\/code>\u201d error is raised when you create new files in your local working copy of a repository and forget to add them to the staging area before you pull a new version of the repository.<br><\/p>\n\n\n\n<p>To fix this error, either add the files causing the error to the staging area or ignore them using the .gitignore file. Now you have the knowledge you need to fix this common Git error like a professional.<br><\/p>\n","protected":false},"excerpt":{"rendered":"If you add files to your local machine then try to pull a remote copy of a repository without adding those files to the repository, you\u2019ll encounter the \u201cnothing added to commit but untracked files present\u201d Git error. This guide discusses what this error means. We\u2019ll walk through two potential solutions to this issue and&hellip;","protected":false},"author":240,"featured_media":22743,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17286],"tags":[],"class_list":{"0":"post-22741","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.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Git nothing added to commit but untracked files present | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn the cause of and the solution to the Git nothing added to commit but untracked files present 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-nothing-added-to-commit-but-untracked-files-present\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git nothing added to commit but untracked files present Solution\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn the cause of and the solution to the Git nothing added to commit but untracked files present error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/\" \/>\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=\"2020-09-17T01:11:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:00:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/mad-fish-digital-VbMql_szSiI-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"667\" \/>\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-nothing-added-to-commit-but-untracked-files-present\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Git nothing added to commit but untracked files present Solution\",\"datePublished\":\"2020-09-17T01:11:16+00:00\",\"dateModified\":\"2023-12-01T12:00:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/\"},\"wordCount\":613,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/mad-fish-digital-VbMql_szSiI-unsplash.jpg\",\"articleSection\":[\"Git\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/\",\"name\":\"Git nothing added to commit but untracked files present | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/mad-fish-digital-VbMql_szSiI-unsplash.jpg\",\"datePublished\":\"2020-09-17T01:11:16+00:00\",\"dateModified\":\"2023-12-01T12:00:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn the cause of and the solution to the Git nothing added to commit but untracked files present error.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/mad-fish-digital-VbMql_szSiI-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/mad-fish-digital-VbMql_szSiI-unsplash.jpg\",\"width\":1000,\"height\":667},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/git-nothing-added-to-commit-but-untracked-files-present\\\/#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 nothing added to commit but untracked files present 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\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"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 nothing added to commit but untracked files present | Career Karma","description":"On Career Karma, learn the cause of and the solution to the Git nothing added to commit but untracked files present 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-nothing-added-to-commit-but-untracked-files-present\/","og_locale":"en_US","og_type":"article","og_title":"Git nothing added to commit but untracked files present Solution","og_description":"On Career Karma, learn the cause of and the solution to the Git nothing added to commit but untracked files present error.","og_url":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-09-17T01:11:16+00:00","article_modified_time":"2023-12-01T12:00:07+00:00","og_image":[{"width":1000,"height":667,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/mad-fish-digital-VbMql_szSiI-unsplash.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-nothing-added-to-commit-but-untracked-files-present\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Git nothing added to commit but untracked files present Solution","datePublished":"2020-09-17T01:11:16+00:00","dateModified":"2023-12-01T12:00:07+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/"},"wordCount":613,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/mad-fish-digital-VbMql_szSiI-unsplash.jpg","articleSection":["Git"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/","url":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/","name":"Git nothing added to commit but untracked files present | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/mad-fish-digital-VbMql_szSiI-unsplash.jpg","datePublished":"2020-09-17T01:11:16+00:00","dateModified":"2023-12-01T12:00:07+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn the cause of and the solution to the Git nothing added to commit but untracked files present error.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/mad-fish-digital-VbMql_szSiI-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/mad-fish-digital-VbMql_szSiI-unsplash.jpg","width":1000,"height":667},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/git-nothing-added-to-commit-but-untracked-files-present\/#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 nothing added to commit but untracked files present 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\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","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\/22741","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=22741"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/22741\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/22743"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=22741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=22741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=22741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}