Installing Git version above 1.8.5 on Centos - linux

Earlier today, I ran into problems moving git folders (Move Git folder containing submodules), and the recommendation was to use a newer git version above 1.8.5. Easy, I thought, but haven't been so lucky.
I've searched high and low, and the most recent version I could find in a yum repository is 1.8.3 (PUIAS_6_computational: puias.math.ias.edu).
I then looked for help installing by source (http://www.howtoforge.com/how-to-install-the-latest-git-version-on-centos and http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/ which are almost identical), however, git is only available to the root user, and it is my understanding both these tutorials shouldn't be installing in /usr/local/.
# cd git-2.0.4
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc
Please provide a means to use Git version greater than 1.8.5.

Try following this set of instructions:
https://www.digitalocean.com/community/tutorials/how-to-install-git-on-centos-7
Then, do this:
yum remove git
exit
# reopen an terminal

Using Docker you have two options:
If you don't want to install dependencies on your host you could build it with docker, you could try this: https://github.com/wood1986/docker-library/tree/master/git
Or a quick but far from ideal way, you could execute it on a docker container, so every time you run git a container is created, your command is executed and the container is automatically removed and a cleaned up is made.
First: sudo yum remove git
then: sudo vim /bin/git
with this:
#!/bin/bash
docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git $#
last: sudo chmod 775 /bin/git
and add .gitconfig with your name and email to your home
Check your version: git --version

Related

What causes git interactive to not be present when git is installed?

Running on Alpine Linux 3.10, I've installed the distribution's git package using apk.
In an existing checkout directory, when I try to launch git add's interactive mode:
$ git add -i
I get the error:
git: 'add--interactive' is not a git command. See 'git --help'.
The git add help indicates that -i is a valid option.
What is happening?
The interactive mode feature of git uses perl, and in many Linux distributions the perl-based parts of git are separated out into another package, so that the core functionality of git can be used without needing to install perl.
On Alpine, the git package just has this core functionality.
To get the missing functionality on Alpine, install the git-perl package.
$ sudo apk add git-perl
On RedHat Linux, you may need to add the perl-Git package:
$ sudo dnf install -y perl-Git

install atom on centos 7 without admin privileges

If it is possible could someone show me how to get the editor Atom working on CentOS Linux release 7.x. I'm working on a computing cluster so I don't have sudo privileges. The instructions here: https://github.com/atom/atom/blob/master/docs/build-instructions/linux.md
seem to require sudo privileges
How do I install it with these constraints?
In the link that you have shared, go to the Instructions section below openSuse instructions.
Step 1 is:
git clone https://github.com/atom/atom
cd atom
Run this step in your home directory.
After that run Step 2 and Step 3 as per the document:
git fetch -p
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
script/build
After that instead of Step 4, run:
script/grunt install --install-dir /home/<your-username>/bin/
This will install the application in your home directory which can be done without sudo privilege. You can add /home/<your-username>/bin at the end of your PATH variable and you should be able to use atom as usual.
All this is assuming that you have the requirements for atom already installed on the system, particularly node.js. If not, you will have to install node.js as well as per https://www.vultr.com/docs/installing-node-js-from-source-on-ubuntu-14-04
In this, instead of ./configure, run ./configure --prefix=/home/<your-username>

Failed to compile module vmmon vmware

I'm going to install VMware 8 on debian 6 with 3.2.xx kernel. I've installed it thoroughly and it seemed that there wasn't any error in installing process.but when I want to run VMware workstation it got an error which says:
Failed to compile module vmmon
what is the cause of this error and how can I solve it?
log ouput:
2012-10-11T19:29:37.521+03:30| vthread-3| I120: Building module with command: /usr/bin/make -j -C /tmp/vmware-root/modules/vmmon-only$
2012-10-11T19:29:39.324+03:30| vthread-3| I120: Failed to compile module vmmon!
I user this commands to solve my problem:
# cd /usr/lib/vmware/modules;
# wget http://pavlinux.ru/vmware/8.0.0/source.tar.lzma;
# tar -xf source.tar.lzma;
# vmware-modconfig --console --install-all;
You need to run this command as root after each kernel upgrades :
vmware-modconfig --console --install-all
Solved in this way
Check your version $ vmplayer -v to insert in the script, in my case is 14.1.7
$ vim vmware-repair.sh
press i and paste
#!/bin/bash
VMWARE_VERSION=workstation-14.1.7 #This needs to be the actual name of the appropriate branch in mkubecek's GitHub repo for your purposes
TMP_FOLDER=/tmp/patch-vmware
rm -fdr $TMP_FOLDER
mkdir -p $TMP_FOLDER
cd $TMP_FOLDER
git clone https://github.com/mkubecek/vmware-host-modules.git #Use `git branch -a` to find all available branches and find the one that's appropriate for you
cd $TMP_FOLDER/vmware-host-modules
git checkout $VMWARE_VERSION
git fetch
make
sudo make install
sudo rm /usr/lib/vmware/lib/libz.so.1/libz.so.1
sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/vmware/lib/libz.so.1/libz.so.1
systemctl restart vmware && vmplayer &
Press ESC then :wq then ENTER
$ chmod +x vmware-repair.sh
$ sudo ./vmware-repair.sh
Source
This could help future users with the same problem
git clone https://github.com/mkubecek/vmware-host-modules
cd vmware-host-modules
git checkout workstation-16.2.3
sudo make ; sudo make install

How can I add npm (node.js package manager) to the PATH?

I installed node.js like this:
cd /usr/local/bin/
git clone --depth 1 http://github.com/joyent/node.git
cd node
git checkout origin/v0.4 # optional. Note that master is unstable.
export JOBS=2 # optional, sets number of parallel commands.
mkdir ~/local
./configure --prefix=$HOME/local/node
make
make install
echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.profile
source ~/.profile
Then I executed this curl http://npmjs.org/install.sh | sh to install npm. After I logged out and logged back in, npm command wasn't recognized:
[/usr/local/bin/node]# npm install now
-bash: npm: command not found
What should I add to the PATH to have npm working?
Try this:
git clone https://github.com/npm/cli
cd npm/cli
sudo make install
That advice comes from of https://github.com/isaacs/npm#readme.
It is not as cute as curl|sh, but works.
Great news : npm now comes with nodejs !
I am a beginner~, but I want be helpful.
I use centos7, and do you know yum (a tool could download and setup programs like mirosoft Windows)
First, I search keyword "node.js" at wiki.centos, I find this. https://wiki.centos.org/SpecialInterestGroup/SCLo/CollectionsList?highlight=%28node.js%29.
There are two versions of nodejs could be used at the moment, I chose the higher one.
the URL is https://www.softwarecollections.org/en/scls/rhscl/rh-nodejs4/
and the command lines are below:
# Install a package with repository for your system:
# On CentOS, install package centos-release-scl available in CentOS repository:
$ sudo yum install centos-release-scl-rh
# On RHEL, enable RHSCL repository for you system:
$ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
# 2. Install the collection:
$ sudo yum install rh-nodejs4
# 3. Start using software collections:
$ scl enable rh-nodejs4 bash

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