How do I completely uninstall git from my Linux Machine - linux

I had installed git by downloading the tar ball and then doing the following steps
./configure --prefix=/scratch/custom/git
make
make install
But after running these commands, I still see that git is created under /usr/local as below
bash-4.1$ whereis git
git: /usr/bin/git /usr/local/git /usr/share/man/man1/git.1.gz
I would like to remove and reinstall again how do i do the same?

If make unistall doesn't work, as mentioned here, uninstalling on linux, try make install again, capturing the output.
Then go through all of the install commands and manually remove the installed files.
Also, 'make -n` may help to determine all of the installed files.

Related

FreeBSD install supervisor

I like to install supervisor on FreeBSD. When I try to install from "/usr/ports/sysutils/py-supervisor" with "make install clean"
I get the error:
make: "/usr/ports/Mk/bsd.port.mk" line 1175: Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE.
I cant find a fix on the internet. How can I install it?
For me on another port the Problem was an empty src dir.
Get the FreeBSD version via uname -a, look up your branch here https://cgit.freebsd.org/src and get the sources via.
git clone -b stable/12 --depth 1 https://git.freebsd.org/src.git /usr/src
Note: 12.2 is the latest of "stable/12" as of writing this 24.11.2021. The -b stands for branch.

No manual entry for giteveryday

I installed git using
_sudo apt-get install git_
But git help everyday gives following error:
No manual entry for giteveryday
Even though, this appears similar to one How do I get git manual entries?
I feel this is different.
git-man is already installed and git help <command> works for all commands except giteveryday.
I don't know why this is happening?? Am I missing something??
Since you have downloaded git from a source and ended up not having the git manpages.
You can download those and then try your command :
sudo apt-get install git-man
Manual download source is here.
Edit : As suggested by #ElpieKay in Ubuntu the same command goes as :
sudo apt-get install git-doc
If Git is installed, you can always run git --html-path to see where the html docs are. You can find the link to giteveryday in the index.html.
Also you can read it online.

unable to install git from source code

I am new to using git. So i first install git from terminal using apt-get but then i remove it as in ubuntu the version is very old.
After this i install git from source code which i download from https://code.google.com/p/git-core/downloads/list. Then these are the commands used by me
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
tar -zxf git-1.9.0.tar.gz
cd git-1.9.0/
make prefix=/usr/local all
sudo make prefix=/usr/local install
Then when i put these commands it is behaving in this manner.
~/git-1.9.0$ which git
/usr/local/bin/git
~/git-1.9.0$ git --version
bash: /usr/bin/git: No such file or directory
Your shell remembers where it found the executable file for commands you run, to save itself the trouble (and you the delays) of hunting them down repeatedly. which isn't a bash builtin, so it doesn't know about that. When you've installed new code it's rarely a bad idea to
$ hash -r # reset the command-lookup hashtable
or if you've got just one particular command in mind,
$ hash -dcommand# forget wherecommandcame from
You might need to add /usr/local/bin/ to your $PATH, perhaps in ~/.bashrc; you might want to put it before /usr/bin/ there.
And you could simply type the entire path of the binary, e.g.
/usr/local/bin/git --version
or
/usr/local/bin/git status
You might try to use strace to understand what is going on.
Did you read git INSTALL file? You probably want to go the autoconf way (e.g. make configure first, then configure with appropriate arguments....) and you surely need to give relevant arguments at configure time, in particular --exec-prefix= and/or --libexecdir= ....

Can I install Mercurial in my home directory?

I would like to install Mercurial on a Linux system where I don't have root access.
How can I do this in a way so that I can easily uninstall Mercurial again and upgrade it when new versions are released?
Also, can I get a package for Windows that does not require admin rights to install?
Mercurial in home directory, how?
It is very easy to compile and install Mercurial in your home directory, I've done so myself.
This linked wiki-post will certainly provide some aid if you have questions;
UnixInstall
Use make install-home to install hg to your home directory, it'll put the binary file in ~/bin and associative files in ~/lib.
When uninstalling or upgrading to a new version you could either delete the files that the makefile have put in, or let make install-home (if upgrading) overwrite the existing files.
Make sure to update your $PATH after installation so that it includes ~/bin.
Install Mercurial on windows without being admin, how?
Following the link below will lead you to the download section of Mercurial. There you'll be able to find installation bundles for Windows that doesn't require administration rights.
Download
I'm aware that this question is already answered but someone could be in the situation I was and that is to have to install without C compiler and make.
Install without C compiler and make
Full description of the solution can be found on following link.
List of commands, without using make
wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
mkdir -p ~/software/lib/python2.5/site-packages
export PYTHONPATH=~/software/lib/python2.5/site-packages
sh setuptools-0.6c11-py2.5.egg --prefix=~/software
export PATH=${PATH}:~/software/bin
easy_install --prefix=~/software docutils
cd ~/software
wget https://www.mercurial-scm.org/release/mercurial-2.5.2.tar.gz
tar xzvf mercurial-2.5.2.tar.gz
cd mercurial-2.5.2.tar.gz
python setup.py --pure install --home="~/software" --force
cd ~/software/lib/python
mv hgext/ ../python2.5/site-packages/
mv mercurial ../python2.5/site-packages/
mv mercurial-2.5.2.egg-info ../python2.5/site-packages/
Append following lines to .bashrc:
export PYTHONPATH=~/software/lib/python2.5/site-packages
export PATH=${PATH}:~/software/bin
Check:
~$ hg
Mercurial Distributed SCM
etc...
Linux
The Mercurial source comes with a Makefile that has a local target. If you run this, then you'll build the C extensions in-place:
$ make local
... (lots of output) ...
python hg version
Mercurial Distributed SCM (version 5b66e55c0d93+20111216)
(see https://www.mercurial-scm.org for more information)
Copyright (C) 2005-2011 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You will need the Python header files, they typically come in a python-dev package. You can then symlink the hg script into a directory in your PATH. I use ~/bin for this:
$ cd ~/bin
$ ln -s ../src/mercurial/hg
You can now run hg from any directory.
If you want to uninstall Mercurial, it's as simple as deleting the directory where you did the compile. Upgrading is also easy: unpack a new release in the directory and run make local again. You can also use the newly install Mercurial to clone the Mercurial repository itself:
$ hg clone https://www.mercurial-scm.org/repo/hg
$ cd hg
$ make local
This gives you a version of Mercurial from the default branch. Use hg update stable before compiling if you want a build from the stable branch instead. That branch is only updated with bugfixes.
Windows
On that platform, you can use a the Inno setup installers. They do not require admin rights. You can couple that with a portable version of TortoiseHg if you like.

Installing Git with non-root user account

I've already set up a Git repository on GitHub and committed a few changes from my Windows machine.
But tomorrow I'll have to work in this repository from a machine running Ubuntu with limited privilege (i.e. no sudo).
Is there a portable version of Git for Linux? Or some source that allows me to compile and install Git only for the current user?
You can download the git source and do ./configure --prefix=/home/user/myroot && make && make install to install git to your home directory provided you have the build tools. If you don't have the build-essential package installed (dpkg --list|grep build-essential), you will need to install those to your home directory as well.
I don't like link-only answers, but this link I followed step-by-step on a Fedora machine and it worked without modification. Very, very easy. The binaries end up in your ~/bin directory. You download a tarball, extract the sources, run make and run make install and that is it.
As the author states, the 2 prerequisites are gcc and ssh and if you meet these git should work for you as a non-root user.
To install git and dependencies from source the following maybe useful.
Replace with the location you are installing your non-root apps and consider checking for latest versions of source code.
wget https://curl.haxx.se/download/curl-7.47.1.tar.gz
tar -xf curl-7.47.1.tar.gz
mkdir <local_curl_dir>
cd curl-7.47.1
./configure --prefix=<local_curl_dir>
make
make install
wget http://downloads.sourceforge.net/expat/expat-2.1.0.tar.gz
tar -xf expat-2.1.0.tar.gz
mkdir <local_expat_dir>
cd expat-2.1.0
./configure --prefix=<local_expat_dir>
make
make install
wget https://github.com/git/git/archive/v2.6.4.tar.gz
tar -xf v2.6.4
mkdir <local_git_dir>
cd git-2.6.4
make configure
./configure --prefix=<local_git_dir>/git --with-curl=<local_curl_dir>/curl --with-expat=<local_expat_dir>/expat
make
make install
This is what I ended up doing, the main trick being the make flags:
wget -O git.tar.gz https://github.com/git/git/archive/v2.17.0.tar.gz
tar zxf git.tar.gz
mv git-2.17.0 git
cd git
make configure
./configure --prefix=`pwd` --with-curl --with-expat
# ./configure --prefix=`pwd`
# Make flags from https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA#mail.gmail.com/
make NO_GETTEXT=Nope NO_TCLTK=Nope
make install NO_GETTEXT=Nope NO_TCLTK=Nope
Credits:
79E09796's answer above was a good tip, but didn't work for my case on Cloudways and did not require compiling curl and expat.
A random email record I found on the internet: https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA#mail.gmail.com/
A related answer is https://askubuntu.com/a/350.
I could get it work with the third method proposed:
apt-get source git
cd git_vXXX
./configure --prefix=$HOME
make
make install
I don't know why, but when I had tried to install from the source download from github instead, I had a lot of problems with missing dependencies
Overkill workaround
Install Anaconda as a user and install git with conda.
Advantages
Anaconda can be installed as user, and a conda environment can be created which can help you to install other packages. This way you don't need to compile git from source, nor you need to install libcurl and perl, so you won't get the error
git: 'remote-https' is not a git command. See 'git --help'
after successfully compiling git.
Steps to install Anaconda, then git
read the Anaconda installation manual which points to the download page's shell script file.
Download the script file:
copy to your local machine and then copy with scp (e.g. winscp) to the Linux machine or
use a terminal on the Linux machine and issue wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh.
add executable rights to yourself on the file by issuing chmod +x Anaconda3-2020.11-Linux-x86_64.sh
follow the installation instructions where you can also specify into which folder you want to install anaconda
after installation, chose one of the possibilities below to successfully invoke git later:
you either activate a conda environment, which is useful e.g. if you need to create different conda environments (it is common if you work with python). To activate an environment, you need to ask the installer (at the end of the installation) to add the conda initialization code into your ~/.bashrc file [see below]. Using this method, your path won't be polluted, and you will see if conda-related binaries are also in your current path. Or you can
add the installed bin's folder to your path, e.g. if you installed anaconda into /home/myusername/anaconda3, it will be in /home/myusername/anaconda3/bin. Your new executable file conda will be also there which will help you to install packages like git, python or pandoc, or
cd into the binary folder of anaconda, e.g. cd /home/myusername/anaconda3/bin, and execute the commands below.
don't forget to take into effect the new settings by, e.g., closing and opening the terminal again if you selected method 1. or 2. in point 5. If you selected 1, you will see something like (base) myusername#servername indicating you are using the base conda environment.
Now you can install git using conda by issuing conda install -c anaconda git.
Your .bashrc will contain likes like this if you told the Anaconda installer to initialize conda for you:
# content of your .bashrc in your home dir
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/myusername/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/myusername/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/myusername/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/myusername/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
for the latest version(which i mean git-2.25.0-rc1 or upper), you need to
wget https://github.com/git/git/releases/tag/v2.25.0-rc1 -O git.zip
unzip git.zip
cd git-2.25.0-rc1
export PATH=`pwd`:$PATH
and of course, you can add the last line into your .bashrc or .zshrc or something else for more convenience.

Resources