I'm trying to make a bash script that installs the latest Git release and using it to clone something within the same script. However this does not seem possible since I would need to close and reopen my terminal before I could use the git command.
Currently, I'm running git clone first before the installation but I wonder if there is a way that it installs first before using the command.
Any lead would be appreciated. Thanks!
CodePudding user response:
Yes This is completely possible.
vim git_latest_release_install_clone_repo.sh
Now, you need to test, and write proper script which also installs other required libraries to build the git, info, docs etc.
I have manually built git from the latest release several times. Not through script, but you can do it through a bash script.
#!/bin/bash
wget https://github.com/git/git/archive/refs/tags/v2.36.0.tar.gz
tar xvzf v2.36.tar.gz
cd git-2.36.0
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
sudo apt-get install asciidoc xmlto docbook2x
sudo apt-get install install-info
make configure
./configure --prefix=/usr
make all doc info
sudo make install install-doc install-html install-info
** I am assuming you have installed, build-essentials
and proper libraries to build git. So, I think the direct manual process is better, so you know, which library is missing, and you can install it.
Or in Ubuntu
sudo apt install --fix-broken
Source 1.5 Getting Started - Installing Git
CodePudding user response:
Yeah so as @torek mentioned, I forgot to export to $PATH. All works now!