Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed the git using this article. Now I want to uninstall the git. How to do it?

share|improve this question

closed as not constructive by EEAA, Michael Hampton, Magellan, mdpc, Scott Pack Nov 1 '12 at 17:52

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Do you still have the source code which you downloaded and did make install with? – Hennes Nov 1 '12 at 7:27
Yes, I have the source code – Mikhail Nov 1 '12 at 7:29
What is the output of 'make uninstall' ? Not all Makefiles have this option, but many do. – Hennes Nov 1 '12 at 7:33
make: *** No rule to make target `uninstall'. Stop. – Mikhail Nov 1 '12 at 7:34
why -1? explain – Mikhail Nov 2 '12 at 5:32
up vote 7 down vote accepted

I found the solution here.

UPDATED 2.11.2012

If you were smart enough and used some non-standard prefix when configured Git so that it has been installed under a specific hierarchy, like under /opt/git, then just delete that hierarchy, recursively.

If not, then you could go like this:

1) Fetch the source tarball of exactly the version you built and installed, unpack.

2) Configure it exactly like you did with the original install with regard to installation locations (prefix, exec-prefix etc); supposedly you should just not override anything.

3) Create a temporary directory to perform installation, like this: $ mkdir /var/tmp/git

4) Install Git passing a proper DESTDIR variable to make: $ make DESTDIR=/var/tmp/git install The Git hierarchy will end up created under that temporary directory.

5) Use the created hierarchy to decide which files to delete under the real hierarchy ("/" itself).

The last step is where "the magic" happens so it bears more explanation. For instance, you could run

$ find /var/tmp/git -type f -printf '/%P\n' | xargs -n 10 rm -f

(as root) do delete the files installed by the first mis-installation into the root filesystem. The encantation above uses the /var/tmp/git hierarchy to print the list of files found, but it replaces the "/var/tmp/git" prefix in them with "/", so that the "/var/tmp/git/usr/bin/git" in the output will end up listed as "/usr/bin/git". This list is then piped to xargs which runs rm on the file names it reads in packs of ten (just to reduce the number of invocations of rm by one order of magnitude).

After dealing with files, run

$ find /var/tmp/git -type d -printf '/%P\n'

to inspect the list of installed directories. These require manual approach so just look at the generated list and think which of them you could safely rmdir from your system (these will be the directories like "/usr/libexec/git" or something like this; you wouldn't probably want to delete "/usr/share/man/mann" or something even if it's empty).

P.S. In the future never install anything into a system by running make install! Most makefiles these days do not support "uninstall" target as they are used to either installing into a private scratch location for testing or to make a package (.rpm, .deb etc) and then the package manager takes care of cleaning up. If you need to install something, try to find an official package or try to backport another official package from a more recent version of your OS, if available. As the last resort, try using the checkinstall tool which tries to create a binary package out of your make install run. This sucks, but still better than bare make install.

share|improve this answer
Please expand some of the details found there. Bit-rot happens, and when that does this answer becomes useless. – sysadmin1138 Nov 1 '12 at 15:53
ok, I updated my answer – Mikhail Nov 2 '12 at 6:41

I just went though 2691 lines of Makefile. Indeed no make uninstall. Drat.

In that case a workaround might be to use the make rpm option. Install the rpm (overwriting all installed files, which should be identical to the already installed files). Then de-install the rpm.

In all future cases build a package (RPM, yum, whatever). It makes maintenance so much easier.

share|improve this answer
Except typically make install puts stuff in prefix /usr/local whereas the rpm/deb/your-package-here run ./configure with different parameters so that the files they install end up with prefix /usr. – ptman Nov 1 '12 at 7:47
I'm newbie in the CentOS. What command should I run? Can you explain more, please – Mikhail Nov 1 '12 at 7:49
I ran the make rpm command. What should I do the next? – Mikhail Nov 1 '12 at 7:55
Start with man rpm or 'rpm --help. It will probably tell you to use rpm -i packagename.rpm. However it might be best to ask the sysadmin at umbrella-web to help you. There is only so much we can do from a distance. – Hennes Nov 1 '12 at 8:04
thanks for help – Mikhail Nov 1 '12 at 8:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.