Skip to content

Instantly share code, notes, and snippets.

@YuMS
Created June 29, 2016 09:28
Show Gist options
  • Select an option

  • Save YuMS/6d7639480b17523f6f01490f285da509 to your computer and use it in GitHub Desktop.

Select an option

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
@israelcena
Copy link
Copy Markdown

Oh Thanks!

@sidofdountio
Copy link
Copy Markdown

Thanks you

@esradev
Copy link
Copy Markdown

esradev commented Dec 15, 2023

Thanks

@promahbubul
Copy link
Copy Markdown

Thank you. This is Worked

@hamadecd
Copy link
Copy Markdown

Thank you! Work on Lubuntu 22.04

@sdr2002
Copy link
Copy Markdown

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
Copy Markdown

Thank you.

@martinfaraz7
Copy link
Copy Markdown

thanks.

@Sierra-034
Copy link
Copy Markdown

Thanks man!!

@DevPacho
Copy link
Copy Markdown

DevPacho commented Apr 1, 2024

Still works! Thanks

@etherblitzdev
Copy link
Copy Markdown

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
Copy Markdown

Thaks, from me, too!

@pheasa-dev
Copy link
Copy Markdown

Thank you for your sharing !!

@cristianjs19
Copy link
Copy Markdown

cristianjs19 commented Apr 21, 2024

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

@Kerem723
Copy link
Copy Markdown

Thanks.

@eignatyev
Copy link
Copy Markdown

thanks a bunch!

@bitterloa
Copy link
Copy Markdown

perfect, thank you

@ankitchauhan2065
Copy link
Copy Markdown

This always works even after 15 years.

@kakonbarman
Copy link
Copy Markdown

Thanks a lot

@khuongln-1346
Copy link
Copy Markdown

Many thanks

@rcedcabrera
Copy link
Copy Markdown

Thanks. Still works in 2025

@aia-a
Copy link
Copy Markdown

aia-a commented May 4, 2025

Great! Thanks!!

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