Skip to content

Instantly share code, notes, and snippets.

@YuMS
Created June 29, 2016 09:28
Show Gist options
  • Save YuMS/6d7639480b17523f6f01490f285da509 to your computer and use it in GitHub Desktop.
Save YuMS/6d7639480b17523f6f01490f285da509 to your computer and use it in GitHub Desktop.
Update git to latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
@promahbubul
Copy link

Thank you. This is Worked

@hamadecd
Copy link

Thank you! Work on Lubuntu 22.04

@sdr2002
Copy link

sdr2002 commented Jan 29, 2024

I am quite new to using Linux and I came across these commands while searching for "updating git ubuntu". Now I want to know exactly what these lines do? espicially this one -> sudo add-apt-repository -y ppa:git-core/ppa this probably updates everything in the repository (sudo apt-get update) [correct me if I am wrong pretty please] sudo apt-get install git -y (not sure what the -y flag does here)


Local Ubuntu adds (= subscribe or register the link of) the external repository as a library of packages it can (automatically) download and list up latest version for further updates.

You are adding the repository that contains the git package to your local ubuntu machine to do this subscription.
Now then, you do apt-get update, then you get the news that the git in that repo has the new version.
Lastly, you download it with apt-get install git.

@minato-unibot
Copy link

Thank you.

@martinfaraz7
Copy link

thanks.

@Sierra-034
Copy link

Thanks man!!

@DevPacho
Copy link

DevPacho commented Apr 1, 2024

Still works! Thanks

@etherblitzdev
Copy link

Works like a charm :-)

git --version
git version 2.43.2

even with prior installed:

gh version
gh version 2.46.0 (2024-03-20)

@under-script
Copy link

Thaks, from me, too!

@pheasa-dev
Copy link

Thank you for your sharing !!

@cristianjs19
Copy link

cristianjs19 commented Apr 21, 2024

Working! ❤️️
git --version
git version 2.43.2
Ubuntu 20.04 focal

@Kerem723
Copy link

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment