"Unable to find remote helper for 'https'" during git clone - linux

I am unable to clone HTTPS repositories. I can clone SSH repos fine, but not HTTPS repos. I cannot test the GIT protocol since I am behind a corporate firewall.
This is what I am trying to do:
$ git clone https://github.com/nvie/gitflow.git
Cloning into gitflow...
fatal: Unable to find remote helper for 'https'
I have so far tried the following (based on Google searches)
Purging and installing Git through apt-get
Installing build-deps for Git through apt-get
Installing curl dev libraries
Installing expat libraries
Downloading Git source and building using:
./configure --prefix=/usr --with-curl --with-expat
Also tried pointing configure at curl binary (./configure --prefix=/usr --with-curl=/usr/bin/curl)
I have tried everything I can find on the internet with no luck. Can anyone help me?
Git version = 1.7.6.4
OS = Ubuntu 11.04

It looks like not having (lib)curl-devel installed when you compile git can cause this.
If you install (lib)curl-devel, and then rebuild/install git, this should solve the problem:
$ yum install curl-devel
$ # cd to wherever the source for git is
$ cd /usr/local/src/git-1.7.9
$ ./configure
$ make
$ make install
This worked for me on Centos 6.3.
If you don't have yum, you can download the source to curl-devel here:
http://curl.se/dlwiz/?type=devel
If you are running Ubuntu instead:
sudo apt-get install libcurl4-openssl-dev

If you are trying to clone then you could use the git transport
For example: git clone git://github.com/fog/fog.git
Vaio ~/Myworks/Hero $ git clone git://github.com/fog/fog.git
Initialized empty Git repository in /home/nthillaiarasu/Myworks/Hero/fog/.git/
remote: Counting objects: 41138, done.
remote: Compressing objects: 100% (13176/13176), done.
remote: Total 41138 (delta 27218), reused 40493 (delta 26708)
Receiving objects: 100% (41138/41138), 5.22 MiB | 58 KiB/s, done.
Resolving deltas: 100% (27218/27218), done

Just in case someone encounters this on a QNAP system or any other system with OPKG as package manager:
You need to install git-http along with git. Like:
opkg install git-http

I used "git://" instead of "https://" and that solved the problem. My final command was:
git clone --recursive git://github.com/ceph/ceph.git

In our case, the problem was fixed when we checked
git --exec-path
was pointing to a path that stopped to exist.
(It was pointing to the path where we've compiled git and not where we copied afterwards for anyone to access it)
We did a:
export GIT_EXEC_PATH=<path_of_/libexec/git-core/>
and solved.

On CentOS 5.x, installing curl-devel fixed the problem for me.

I had same problem and simple to resolve it.
Just uninstall git and re-install it.
#apt-get remove --purge git-svn git-core
#rm /usr/local/bin/git
#apt-get install git-svn git-core
and everything works well.
Hope this help.

I had the exact same issue and it boiled down to an unmet dependency, however, I tried the accepted answer's solution and it did not work.
What finally worked for me was installing all of the following (this is RedHat):
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
Afterwards, I ran the other commands as specified and it worked:
./configure
make
sudo make prefix=/usr/local install
I pulled the list of dependencies directly from Git's website. Apparently I should have started there :/

If this problem occurred while tying to use github via the github commandline utility, the problem is likely due to using the snap version of gh.
If you can clone with git clone and not get this error, then the problem is with the snap version of gh.
In the end, the github docs saved the day!
https://github.com/cli/cli/blob/trunk/docs/install_linux.md
Here's the steps to save some time (debian/ubuntu/Raspberry PiOS):
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh

The easiest way to fix this problem is to ensure that the git-core is added to the path for your current user
If you add the following to your bash profile file in ~/.bash_profile this should normally resolve the issue
PATH=$PATH:/usr/libexec/git-core

This worked for me in Centos 6.6 to install git 2.3.1:
I didn't have curl-devel installed (checking for curl_global_init in -lcurl... no). The key was to generate configure script
add rpmforge for docboox2x
install packages
yum install openssl-devel zlib-devel perl-ExtUtils-MakeMaker svn tcl perl-Locale-Msgfmt gettext asciidoc xmlto docbook2x
make symlink
ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
build git
# download latest relase from https://github.com/git/git/releases
curl -O -J -L https://github.com/git/git/archive/v2.13.0.tar.gz
tar xf git-2.13.0.tar.gz
cd git-2.13.0
make configure
./configure --prefix=/usr
make all doc
make install install-doc install-html

On Mac OS X 10.9 Mavericks, the solution that worked is as follows
rvm pkg install openssl
CC=/usr/local/bin/gcc-4.2 CPP=/usr/local/bin/cpp-4.2 CXX=/usr/local/bin/g++-4.2 rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr
This is to compile Ruby with OpenSSL Support. Next, uninstall all the old versions.
brew uninstall openssl
brew uninstall curl
brew uninstall git
Next, install the updated versions. The git installation is dependent on an updated version of CURL.
brew install openssl
brew install curl
brew install git

I was having this issue when using capistrano to deploy a rails app. The problem was that my user only had a jailed shell access in cpanel. Changing it to normal shell access fixed my problem.

For those using git with Jenkins under a windows system, you need to configure the location of git.exe under:
Manage Jenkins => Global Tool Configuration => Git => Path to Git executable and fill-in the path to git.exe, for example; C:\Program Files\Git\bin\git.exe

I had a lot of problems with this remote helper issue. I ensured that I had installed all the expat, curl etc. but finally resolved it by updating gcc after finding that version 4.4.4 was duff. Just did a yum update and recompiled with 4.4.6.

On centos 7:
$ yum install curl-devel
$ yum reinstall git
That work´s for me.

I got the same problem today: git http broken after years of happy service. It seems caused by some Perl lib updates. Tried some sane suggestions on web, none worked. Had enough, I just removed all git stuff, got a new tarball from http://git-scm.com/, compiled and installed, and all things are back to normal. Give it try, or you can go dig deep into your logs...

I had to add a couple of extra installs running CentOS release 5.10 (Final):
yum install openssl097a.x86_64
yum install openssl-perl.x86_64
Using git-1.8.5:
./configure
make clean
make
make install
git clone https://github.com/michaelficarra/CoffeeScriptRedux.git
Cloning into 'CoffeeScriptRedux'...
remote: Reusing existing pack: 4577, done.
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 4601 (delta 13), reused 11 (delta 1)
Receiving objects: 100% (4601/4601), 2.60 MiB | 126.00 KiB/s, done.
Resolving deltas: 100% (2654/2654), done.
Checking connectivity... done.

I landed here once because I was working with git itself. When I built it the default makefile installed the binary in ~/bin/git. Since my PATH had ~/bin first when I ran 'git pull --rebase' it used the one in ~/bin and consequently could not locate the helpers.
I worked around the issue by running '/usr/bin/git ...' with a full path (alternatively I could have adjusted my PATH).

worked
1- I had to remove git:
sudo apt-get remove git
2- re - install git with the -all suffix:
sudo apt-get install git-all
as taught here: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
3- checked all settings (user name & email) of my github account
by the way I was mistaken the good email which was the source of my errors ;)
https://github.com/settings/profile
check your username
https://github.com/settings/emails
check your email is the good one
4- I have followed the tutorial of git here
https://help.github.com/articles/connecting-to-github-with-ssh

In my case nothing was successful, after a while looking what was happening I found this on my config file. Not sure how it got there
% cat ~/.gitconfig
[user]
email = xxxxxxx#gmail.com
name = xxxxxx
[alias]
g = grep -n -i --heading --break
[url "git+https://github.com/"]
insteadOf = git#github.com:
[url "git+https://"]
insteadOf = git://
After removing the url properties everything was working fine again

CentOS Minimal usually install version 1.8 git by yum install gitcommand.
The best way is to build & install it from source code. Current version is 2.18.0.
Download the source code from https://mirrors.edge.kernel.org/pub/software/scm/git/
or curl -o git-2.18.0.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
Unzip by tar -zxf git-2.18.0.tar.gz && cd git-2.18.0
Install the dependency package by executing yum install autoconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto openjade perl* texinfo
Install docbook2X, it's not in the rpm repository. Download and install by
$ curl -o docbook2X-0.8.8-17.el7.x86_64.rpm http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/d/docbook2X-0.8.8-17.el7.x86_64.rpm
$ rpm -Uvh docbook2X-0.8.8-17.el7.x86_64.rpm
And make a unix link name:
ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
Compile and install, reference to https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
$ make configure
$ ./configure --prefix=/usr
$ make all doc info
$ sudo make install install-doc install-html install-info
Reboot your server (If not, you may encounter Unable to find remote helper for 'https' error)
$ reboot now
Test:
$ git clone https://github.com/volnet/v-labs.git
$ cd v-labs
$ touch test.txt
$ git add .
$ git commit -m "test git install"
$ git push -u

I got this error on Windows while using TortoiseGit. Reinstalling Git for Windows and telling TortoiseGit the path to git.exe by re-running the First Start Wizard fixed it.

In my case git --exec-path was pointing to the correct path and git-remote-https existed but didn't have execution permission. So chmod +x git-remote-http fixed the issue.

found this in 2020
and solution solved the issue with OMZ
https://stackoverflow.com/a/13018777/13222154
...
➜ ~ cd $ZSH
➜ .oh-my-zsh (master) ✗ git remote -v
origin https://github.com/ohmyzsh/ohmyzsh.git (fetch)
origin https://github.com/ohmyzsh/ohmyzsh.git (push)
➜ .oh-my-zsh (master) ✗ date ; omz update
Wed Sep 30 16:16:31 CDT 2020
Updating Oh My Zsh
fatal: Unable to find remote helper for 'https'
There was an error updating. Try again later?
omz::update: restarting the zsh session...
...
ln "$execdir/git-remote-http" "$execdir/$p" 2>/dev/null || \
ln -s "git-remote-http" "$execdir/$p" 2>/dev/null || \
cp "$execdir/git-remote-http" "$execdir/$p" || exit; \
done && \
./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"
➜ git-2.9.5
➜ git-2.9.5
➜ git-2.9.5
➜ git-2.9.5 omz update
Updating Oh My Zsh
remote: Enumerating objects: 296, done.
remote: Counting objects: 100% (296/296), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 221 (delta 146), reused 179 (delta 105), pack-reused 0
Receiving objects: 100% (221/221), 42.89 KiB | 0 bytes/s, done.
Resolving deltas: 100% (146/146), completed with 52 local objects.
From https://github.com/ohmyzsh/ohmyzsh
* branch master -> FETCH_HEAD
7deda85..f776af2 master -> origin/master
Created autostash: 273f6e9

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

No active remote repositories configured

In FreeBSD 8.4, pkg install is not working giving error.
$ pkg install git
pkg:No active remote repositories configured.
pkg_add -r application_name is working and installing from ports is also it works fine but for above problem, is there any solution?
I found a link saying the remote repo in /etc/pkg/FreeBSD.conf does not exist!
So we have to create one.
$ vim /etc/pkg/FreeBSD.conf
FreeBSD: {
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: yes
}
Also need to create the certificate https://svn0.us-west.freebsd.org/base/head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 in /usr/share/keys/pkg/trusted/
$ mkdir -p /usr/share/keys/pkg/trusted
$ wget https://svn0.us-west.freebsd.org/base/head/share/keys/pkg/trusted/pkg.freebsd.org.2013102301 --no-check-certificate -O /usr/share/keys/pkg/trusted/pkg.freebsd.org.2013102301
Now, we can update pkg and see if we have a repo:
/usr/share/keys/pkg/trusted $ pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 968 B 1.0kB/s 00:01
Fetching packagesite.txz: 100% 5 MiB 98.8kB/s 00:56
Processing entries: 100%
FreeBSD repository update completed. 24610 packages processed.

Install git or update git without apt-get or yum

I have some linux boxes that do not allow me to use yum to install packages. Instead I need to download the zip or tar and then use a package manager to install the items on my linux boxes.
When you go to the git-scm page, the only way they provide to install git is to use yum, apt-get, etc from the command line.
Why is there not just a zip file?
Where can I find the package to install?
Has anyone else had this same issue?
I had the same issue before. I tried to install git from source and it works.
Intalling these packages first:
curl
autoconf
zlib-devel
openssl-devel
perl
cpio
expat-devel
gettext-devel
Getting the GIT scm source code:
git-latest.tar.gz
Compiling the GIT scm from source
tar xzvf git-latest.tar.gz
cd git-{date} // edit it
autoconf
./configure --with-curl=/usr/local
make
make install

How to install latest version of git on CentOS 8.x/7.x/6.x

I used the usual:
yum install git
It did not install the latest version of git on my CentOS 6. How can I update to the latest version of git for CentOS 6? The solution can be applicable to newer versions of CentOS such as CentOS 7.
You can use WANDisco's CentOS repository to install Git 2.x: for CentOS 6, for CentOS 7
Install WANDisco repo package:
yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
- or -
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
- or -
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
Install the latest version of Git 2.x:
yum install git
Verify the version of Git that was installed:
git --version
As of 02 Mar. 2020, the latest available version from WANDisco is 2.22.0.
Having a look at the blog here I found the solution in one of the comments. Make sure you got the rpmforge repository added to your CentOS yum and just run the flowing command:
yum --disablerepo=base,updates --enablerepo=rpmforge-extras install git
If you already have git installed then use:
yum --disablerepo=base,updates --enablerepo=rpmforge-extras update git
Related question(s):
Facing issues while upgrading git to latest version on CentOS 6.4
Note update:
Thanks to Anthony Hatzopoulos, for git v1.8x you'll need to use git18 as in:
yum --disablerepo=base,updates --enablerepo=rpmforge-extras install git18
Note update 2:
Also thanks to #Axlrod for the below hint and #Hiphip for the feedback:
Change the rpmforge.repo file to have rpmforge-extras to enabled,
yum update git. Otherwise it complained about dependency problems.
Note update 3:
Installing a specific version of git say 2.x
I found this nice and easy-to-follow guide on how to download the GIT source and compile it yourself (and install it). If the accepted answer does not give you the version you want, try the following instructions:
http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/
(And pasted/reformatted from above source in case it is removed later)
Step 1: Install Required Packages
Firstly we need to make sure that we have installed required packages on your system. Use following command to install required packages before compiling Git source.
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install gcc perl-ExtUtils-MakeMaker
Step 2: Uninstall old Git RPM
Now remove any prior installation of Git through RPM file or Yum package manager. If your older version is also compiled through source, then skip this step.
# yum remove git
Step 3: Download and Compile Git Source
Download git source code from kernel git or simply use following command to download Git 2.0.4.
# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.0.4.tar.gz
# tar xzf git-2.0.4.tar.gz
After downloading and extracting Git source code, Use following command to compile source code.
# 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
# or
# echo 'export PATH=$PATH:/usr/local/git/bin' > /etc/profile.d/git.sh
#
# source /etc/bashrc
HINT 1:
Updated method of adding compiled git bin directory to bashrc. Because echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc used "" instead of '', it would expand the current session's value for $PATH instead of keeping it as a variable, and could adversely affect the entire system. At the minimum, it should use '' instead of "" and should really be a separate script in /etc/profile.d/
HINT 2 (#DJB):
/usr/local/git/bin before $PATH, since the older version of git was already on $PATH: export PATH=/usr/local/git/bin:$PATH
Step 4. Check Git Version
One completion of above steps, you have successfully install Git in your system. Let use following command to check git version
# git --version
git version 2.0.4
I also wanted to add that the "Getting Started" guide at the GIT website also includes instructions on how to download and compile it yourself:
http://git-scm.com/book/en/v2/Getting-Started-Installing-Git
Rackspace maintains the ius repository, which contains a reasonably up-to-date git, but the stock git has to first be removed.
CentOS 6 or 7 instructions (run as root or with sudo):
# retrieve and check CENTOS_MAIN_VERSION (6 or 7):
CENTOS_MAIN_VERSION=$(cat /etc/centos-release | awk -F 'release[ ]*' '{print $2}' | awk -F '.' '{print $1}')
echo $CENTOS_MAIN_VERSION
# output should be "6" or "7"
# Install IUS Repo and Epel-Release:
yum install -y https://repo.ius.io/ius-release-el${CENTOS_MAIN_VERSION}.rpm
yum install -y epel-release
# re-install git:
yum erase -y git*
yum install -y git-core
# check version:
git --version
# output: git version 2.24.3
Note: git-all instead of git-core often installs an old version. Try e.g. git224-all instead.
The script is tested on a CentOS 7 docker image (7e6257c9f8d8) and on a CentOS 6 docker image (d0957ffdf8a2).
I found this nice and easy-to-follow guide on how to download the GIT source and compile it yourself (and install it). If the accepted answer does not give you the version you want, try the following instructions:
http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/
(And pasted/reformatted from above source in case it is removed later)
Step 1: Install Required Packages
Firstly we need to make sure that we have installed required packages on your system. Use following command to install required packages before compiling Git source.
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install gcc perl-ExtUtils-MakeMaker
Step 2: Uninstall old Git RPM
Now remove any prior installation of Git through RPM file or Yum package manager. If your older version is also compiled through source, then skip this step.
# yum remove git
Step 3: Download and Compile Git Source
Download git source code from kernel git or simply use following command to download Git 2.5.3.
# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.5.3.tar.gz
# tar xzf git-2.5.3.tar.gz
After downloading and extracting Git source code, Use following command to compile source code.
# cd git-2.5.3
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo 'pathmunge /usr/local/git/bin/' > /etc/profile.d/git.sh
# chmod +x /etc/profile.d/git.sh
# source /etc/bashrc
Step 4. Check Git Version
On completion of above steps, you have successfully install Git in your system. Use the following command to check the git version
# git --version
git version 2.5.3
I also wanted to add that the "Getting Started" guide at the GIT website also includes instructions on how to download and compile it yourself:
http://git-scm.com/book/en/v2/Getting-Started-Installing-Git
My personal preference is to build rpm packages for CentOS when installing non-standard software and replacing distributed components. For this I recommend that you use Mock to create a clean build environment.
The procedure is:
Obtain the source RPMS or a suitable SPEC file and pristine source tarball. In this case one may find source RPM packages for git2X for CentOS-6 at: http://dl.iuscommunity.org/pub/ius/archive/CentOS/6/SRPMS/. Packages for other CentOS releases are also available.
Install the necessary support software:
yum install epel-release # you need this for mock
yum install rpm-build
yum install redhat-rpm-config
yum install rpmdevtools
yum install mock
Add a rpm build user account (do not build as root or as a real user - security issues will come back to bite you).
sudo adduser builder --home-dir /home/builder \
--create-home --user-group --groups mock \
--shell /bin/bash --comment "rpm package builder"
Next we need a build environment.
su -l builder
rpmdev-setuptree
This produces the following directory structure:
~
└── rpmbuild
├── BUILD
├── RPMS
├── SOURCES
├── SPECS
└── SRPMS
We are using a prepared SRPMS so the SOURCES tarballs can be ignored for this case and we can go direct to SRPMS.
wget http://dl.iuscommunity.org/pub/ius/archive/CentOS/6/SRPMS/git2u-2.5.3-1.ius.centos6.src.rpm \
-O ~/rpmbuild/SRPMS/git2u-2.5.3-1.ius.centos6.src.rpm
Configure mock (as root)
cd /etc/mock
rm default.cfg
ln -s epel-6-x86_64.cfg default.cfg
vim default.cfg
Disable the beta repos. Enable the base and update repos.
Initialize the build tree (/var/lib/mock is default)
mock --init
If we were building from SOURCES then this is where we would employ the SPEC file and use mock --buildsrpm . . .. But in this case we go directly to the binary build step:
mock --no-clean --rebuild ~/rpmbuild/SRPMS/git2u-2.5.3-1.ius.centos6.src.rpm
This will resolve the build dependencies and download them (about 95 or so packages) into the clean build root. It will then extract the sources and build the binary from the provided SRPM and leave it in /var/lib/mock/epel-6-x86_64/result; or in whatever custom build root location and architecture you provided. It will take a long time. There is a lot to this package; particularly documentation.
If all goes well then you should end up with a suit of RPM packages suitable for installation in place of the distro version. This is what I ended up with:
ll /var/lib/mock/epel-6-x86_64/result
total 34996
-rw-rw-r--. 1 byrnejb mock 448455 Oct 30 10:09 build.log
-rw-rw-r--. 1 byrnejb mock 52464 Oct 30 10:09 emacs-git2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 47228 Oct 30 10:09 emacs-git2u-el-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 8474478 Oct 30 09:57 git2u-2.5.3-1.ius.el6.src.rpm
-rw-rw-r--. 1 byrnejb mock 8877584 Oct 30 10:09 git2u-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 27284 Oct 30 10:09 git2u-all-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 27800 Oct 30 10:09 git2u-bzr-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 112564 Oct 30 10:09 git2u-cvs-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 436176 Oct 30 10:09 git2u-daemon-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 15858600 Oct 30 10:09 git2u-debuginfo-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 60556 Oct 30 10:09 git2u-email-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 274888 Oct 30 10:09 git2u-gui-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 79176 Oct 30 10:09 git2u-p4-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 483132 Oct 30 10:09 git2u-svn-2.5.3-1.ius.el6.x86_64.rpm
-rw-rw-r--. 1 byrnejb mock 173732 Oct 30 10:09 gitk2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 115692 Oct 30 10:09 gitweb2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 57196 Oct 30 10:09 perl-Git2u-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 89900 Oct 30 10:09 perl-Git2u-SVN-2.5.3-1.ius.el6.noarch.rpm
-rw-rw-r--. 1 byrnejb mock 101026 Oct 30 10:09 root.log
-rw-rw-r--. 1 byrnejb mock 980 Oct 30 10:09 state.log
Install using yum or rpm.
You will require git2u-2.5.3-1.ius.el6.x86_64.rpm at a minimum and such additional support packages as it requires (perl-Git2u-2.5.3-1.ius.el6.noarch.rpm) or you desire.
This build has a cyclic dependency: git2u-2.5.3-1.ius.el6.x86_64.rpm depends upon perl-Git2u-2.5.3-1.ius.el6.noarch.rpm and perl-Git2u-2.5.3-1.ius.el6.noarch.rpm depends upon git2u-2.5.3-1.ius.el6.x86_64.rpm. A straight install with rpm will thus fail.
There are two ways of dealing with it:
Install both at the same time via yum:
yum localinstall \
git2u-2.5.3-1.ius.el6.x86_64.rpm \
perl-Git2u-2.5.3-1.ius.el6.noarch.rpm`
Setup a local yum repo.
I am including my LocalFile.repo file below as it contains instructions on how to do this and provides the necessary repo file at the same time.
cat /etc/yum.repos.d/LocalFile.repo
# LocalFile.repo
#
# This repo is used with a local filesystem repo.
#
# To use this repo place the rpm package in /root/RPMS/yum.repo/Packages.
# Then run: createrepo --database --update /root/RPMS/yum.repo.
#
# To use:
# yum --enablerepo=localfile [command]
#
# or to use only ONLY this repo, do this:
#
# yum --disablerepo=\* --enablerepo=localfile [command]
[localfile]
baseurl=file:///root/RPMS/yum.repo
name=CentOS-$releasever - Local Filesystem repo
# Before persistently enabling this repo see the priority note below.
enabled=0
gpgcheck=0
# When this repo is enabled all packages in repos with priority>5
# will not be updated even when they have a more recent version.
# Be careful with this.
priority=5
You also may be required to manually pre-install additional dependency packages such as perl-TermReadKey available from the usual repositories.
To build and install modern Git on CentOS 6:
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
export GIT_VERSION=2.6.4
mkdir /root/git
cd /root/git
wget "https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz"
tar xvzf "git-${GIT_VERSION}.tar.gz"
cd git-${GIT_VERSION}
make prefix=/usr/local all
make prefix=/usr/local install
yum remove -y git
git --version # should be GIT_VERSION
as git says:
RHEL and derivatives typically ship older versions of git. You can
download a tarball and build from source, or use a 3rd-party
repository such as the IUS Community Project to obtain a more recent
version of git.
there is good tutorial here.
in my case (Centos7 server) after install had to logout and login again.
Build latest version of git on Centos 6/7
Preparing system to building rpms
Install epel:
For EL6, use:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
For EL7, use:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install fedpkg:
sudo yum install fedpkg
Add yourself into group mock (you might need to re-login to server after this change):
sudo usermod -a -G mock $USER
Download git
Download git sources:
fedpkg clone -a git && cd git
fedpkg sources
Verify sources:
sha512sum -c sources
Build rpm
Create srmp. Use el6 for RHEL6, el7 for RHEL7.
fedpkg --dist el7 srpm
Build package in mock:
mock -r epel-7-x86_64 git-2.16.0-1.el7.src.rpm
Install latest version of git rpm from /var/lib/mock/epel-7-x86_64/result/. Note, you might need to uninstall existing version of the git from your system first.
This instruction is based on the mailing list post by Todd Zullinger.
This guide worked:
# hostnamectl
Operating System: CentOS Linux 7 (Core)
# git --version
git version 1.8.3.1
# sudo yum remove git*
# sudo yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
# sudo yum install git
# git --version
git version 2.24.1
Here's my method to install git on centos 6.
sudo yum groupinstall "Development Tools"
sudo yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel curl-devel
sudo yum install wget
cd ~
wget -O git.zip https://github.com/git/git/archive/v2.7.2.zip
unzip git.zip
cd git-2.7.2
make configure
./configure --prefix=/usr/local
make all doc
sudo make install install-doc install-html
Adding a roundabout answer here. I was struggling to install git on an RHEL 6.0 Amazon instance, and what ended up saving me was ... conda, as in Anaconda Python.
I installed conda on the command line from the archives (code modeled after this):
wget http://repo.continuum.io/miniconda/Miniconda2-4.2.12-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
and then ran
conda install git
and a relatively recent version git was installed. Today is 12/26/2016 and the version is 2.9.3.
This may be irrelevant. It is for people don't want build the latest git on the host meanwhile they still can get the latest git.
I think most people don't like building the latest git on CentOS because the dependencies will contaminate the host and you have to run lots of commands. Therefore, I have an idea which is building git inside the Docker container and then install the executable via the docker volume mount. After that, you can delete the image and container.
Yes, the downside is you have to install docker. But the least dependencies are introduced to the host and you don't have to install other yum repo.
Here is my repository. https://github.com/wood1986/docker-library/tree/master/git
If git already installed first remove old git
sudo yum remove git*
And install latest version of git
yum install -y git-core
Check Version
git --version
bingo!!
It can be very confusing, and dangerous, to replace the upstream base repositories with add-on repositories without considerable testing and thought. RPMforge, in particularly, is effectively moribund and is not getting updates.
I personally publish tools for building git 2.4, wrapped as an alternatively named "git24" package, at https://github.com/nkadel/git24-srpm/. Feel free to access and fork those if you want packages distinguished from the standard system packages, much as "samba" and "samba4" packages are differentiated.

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