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

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

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.

Installing Git version above 1.8.5 on Centos

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

Compiling VIM with breakindent patch

In Ubuntu 12.04 Precise the only way to get breakindent patch working in VIM seems to be compiling VIM itself after patching it. Here's what I've done:
Install pbuilder and create local environment
sudo apt-get install pbuilder debootstrap
sudo pbuilder create --debootstrapopts --variant=buildd
Get the sources
sudo apt-get source vim
Patch them with breakindent patch retrieved from the official repo
cd vim-7.3.429
patch -p1 < vim-breakindent.patch
sudo pbuilder build vim_7.3.429-2ubuntu2.1.dsc
Pbuilder correctly generates deb packages but, after installing them, no breakindent option is available:
:set bri
E518: Unknown option: bri
Where's the mistake?
Thank you
pbuilder is still using the unmodified .dsc, .orig.tar.gz, and .debian.tar.gz to build the package. Applying the patch to your local copy doesn't help.
You should probably add the patch to debian/patches/ and debian/patches/series, bump the local version number in debian/changelog (debchange can help), and re-make the source archive (something like dpkg-buildpackage -S).
Update: it worked following some more steps.
After apt-get source:
cd vim-7.3.429
sudo chmod u=rw,g=r,o=r ../vim-breakindent.patch
sudo cp ../vim-breakindent.patch debian/patches/debian/.
added one new entry in debian/changelog, bumping version from vim_7.3.429-2ubuntu2.1 to vim_7.3.429-2ubuntu2.2
added debian/vim-breakindent.patch at the end of debian/patches/series
generate new source package:
sudo pdebuild
compile the new .dsc:
sudo pbuilder build vim_7.3.429-2ubuntu2.2.dsc
install new debs:
sudo dpkg -i /var/cache/pbuilder/result/*.deb

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