Score:0

How to remove git from a specific folder?

tl flag

I have a CentOS 7 system. It has git 2.27.0 installed, but that install, for reasons we can't figure out, won't talk to our https gitlab instance. It keeps failing on "unable to find remote helper for 'https'".

So, I attempted to upgrade git, using 'sudo yum upgrade git', which claims there's no git package installed. But if I do a 'git --version', I get "git version 2.27.0". A "whereis git" gives me "git: /usr/local/bin/git". If I do a 'sudo yum remove git', I get "No match for argument: git, No Packages marked for removal".

I've tried installing git, which works, after a fashion. As in, a new git instance is installed on my system; I get lots of messages that the install worked fine and git 2.31.1 was installed. But if I do git version, I get again get 2.27.0. If I then remove git again, it removes my 2.31.1 version, and keeps the 2.27.0. But, again, yum claims it's not really there. The $PATH has /usr/local/bin before /usr/bin. I assume it's installing the newer copy in /usr/bin, then completely ignoring the copy already in /usr/local/bin.

So, is there a way to tell yum to remove the copy at /usr/local/bin? Because when I try to do 'sudo yum remove /usr/local/bin/git' I get "No match for argument: /usr/local/bin/git".

Score:3
in flag

The fact that git is in the folder /usr/local/bin suggests that it had not been installed via the system package management.

Maybe it has been compiled from source, maybe it was installed differently, there is no way to know.

If it has been compiled and installed from source, AND the source code is still on the system, you might be able to remove it using make uninstall in the source folder.

If not you will have to delete every file that belongs to that git install manually (or at least the git binary and ignore that you have more orphaned files on your system). Your best chance is to ask whomever installed it.

You could just install git with the package manager. It should supersede the older installation, or you should be able to make it the "primary" by adjusting the order of the bin directories in the path variable.

user3224303 avatar
tl flag
I did install git through yum, but either the new version of git also didn't know what to do with https, or more likely my calls to git were still going through the old version. I do know who built these instances, but I asked them about it first! So far they're mum. Thanks for your detailed answer, I'm running by others in my group now to see if they have a preference.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.