Skip to main content

Explore your training options in 10 minutes

Git nothing added to commit but untracked files present Solution

James Gallagher - November 03, 2020

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’ll encounter the “nothing added to commit but untracked files present” Git error.

This guide discusses what this error means. We’ll walk through two potential solutions to this issue and their benefits and drawbacks.

nothing added to commit but untracked files present

Git is a distributed version control system . 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.

Get offers and scholarships from top coding schools illustration

Find Your Bootcamp Match

  • Career Karma matches you with top tech bootcamps
  • Access exclusive scholarships and prep courses

By continuing you agree to our Terms of Service and Privacy Policy , and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.

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.

Executing a git pull command on a repository where you have not added every file to the staging area or a commit will result in the following error:

nothing added to commit but untracked files present

Untracked Files: A Primer

Untracked files are files inside a project that have been configured with Git, but have not become part of the Git repository.

Files only become part of a Git repository if you add them using the “git add” 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.

Untracked files should either be added to a project, or ignored using a rule in a .gitignore file.

The Solution

There are two potential solutions to this error.

The first solution is to add all the untracked files into a Git repository. Do this using the git add command :

git add

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.

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.

Venus, a software engineer at Rockbot

"Career Karma entered my life when I needed it most and quickly helped me match with a bootcamp. Two months after graduating, I found my dream job that aligned with my values and goals in life!"

Venus, Software Engineer at Rockbot

You can ignore files by adding an entry to the .gitignore file in your project:

You can place a gitignore file in any directory in your project. It’s 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.

Now that we’ve solved the error, we can pull the most recent version of a Git repository using the git pull command:

git pull

This command should succeed because we are now tracking or ignoring all the files that are in the project folder.


The “ nothing added to commit but untracked files present ” 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.

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.

About us: Career Karma is a platform designed to help job seekers find, research, and connect with job training programs to advance their careers. Learn about the CK publication.

What's Next?

James Gallagher

About the author: 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,, Afrotech, and others.

Skip to main content