Software & AppsOperating SystemLinux

How To Uninstall Git from Ubuntu Desktop 12.04

Ubuntu 7

In this article, we will guide you through the process of uninstalling Git from your Ubuntu Desktop 12.04 machine. Git is a widely used version control system that is essential for many developers. However, if you no longer need it, or if you want to reinstall it to resolve some issues, you might want to uninstall it first.

Quick Answer

To uninstall Git from Ubuntu Desktop 12.04, open a terminal window and run the command sudo apt-get remove git. Additionally, you can remove leftover configuration files and dependencies with sudo apt-get autoremove. If you want to remove personal Git settings, delete the ~/.gitconfig file. To reinstall Git, use sudo apt-get install git.


Before we start, make sure you have administrative access to your Ubuntu machine. You will need to run commands as the root user or with sudo privileges.

Step 1: Open a Terminal Window

To start, open your terminal. You can do this by pressing Ctrl+Alt+T on your keyboard or by searching for ‘Terminal’ in the Ubuntu Dash.

Step 2: Removing the Git Package

To remove the Git package, you can use the apt-get remove command followed by the package name, which is git in this case. Here is the command you need to run:

sudo apt-get remove git

The sudo command allows you to run commands with administrative privileges. The apt-get remove command is used to remove a package.

Step 3: Removing Leftover Configuration Files and Dependencies

After uninstalling the Git package, there might be some leftover configuration files and dependencies. To remove these, you can use the apt-get autoremove command:

sudo apt-get autoremove

This command removes packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.

Step 4: Removing Personal Git Settings

If you want to remove your personal Git settings and return to a pristine state, you can delete the ~/.gitconfig file. This file contains your personal Git settings. Here is the command to remove it:

rm ~/.gitconfig

The rm command is used to remove files or directories.

Step 5: Reinstalling Git (Optional)

If you encounter any installation issues or want to reinstall Git, you can use the apt-get install command:

sudo apt-get install git

This command installs the Git package.


That’s it! You have successfully uninstalled Git from your Ubuntu Desktop 12.04 machine. Remember, it’s always a good idea to backup any important Git repositories or files before uninstalling Git.

If you want to learn more about Git, you can visit the official Git documentation. For more information about apt-get commands, you can check the Ubuntu manpages.

Can I uninstall Git without affecting my projects or repositories?

Yes, uninstalling Git will not affect your projects or repositories. The uninstallation process only removes the Git software and its associated files, not your actual projects or repositories.

Will uninstalling Git delete all my Git repositories?

No, uninstalling Git will not delete your Git repositories. Your repositories are stored separately from the Git software. However, it is always a good practice to backup your important repositories before making any changes to your system.

How can I check if Git is successfully uninstalled?

After running the uninstallation command, you can check if Git is successfully uninstalled by running the command git --version. If Git is uninstalled, the terminal will display a message stating that the command ‘git’ is not found.

Can I reinstall Git after uninstalling it?

Yes, you can reinstall Git after uninstalling it. Simply follow the steps mentioned in the article to reinstall Git using the apt-get install git command.

Will uninstalling Git remove all my personal Git settings?

Uninstalling Git will remove the Git software and its associated files, but it will not automatically remove your personal Git settings. However, if you want to remove your personal Git settings and return to a pristine state, you can delete the ~/.gitconfig file as mentioned in Step 4 of the article.

Leave a Comment

Your email address will not be published. Required fields are marked *