Add Repository on EC2 Ubuntu to Get Updated Version of git
Your version of git may be outdated if using the default repositories on an AWS EC2 instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
⚙️ Part of my series on Automating Cybersecurity Metrics. The Code.
🔒 Related Stories: GitHub Security | Application Security | Secure Code | Ubuntu on AWS
💻 Free Content on Jobs in Cybersecurity | ✉️ Sign up for the Email List
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ojDZgdzVLSlOyGz15n9zOA.png)
I recently noticed that the documentation is for git version 2.41.0 and a command I was trying to use was not working. I decided to find if that is the latest version and if my EC2 Ubuntu instance was running the latest version of git.
I found that is the latest version for a Mac when I visited this page:
They don’t really make it easy from there to see if that same version is the latest for other operating systems and I wasn’t logged into the Ubuntu gui at the the time but I presumed that was also the latest version for Ubuntu. I’ll get back to that in a bit.
Note that I am using the LTS version of Ubuntu, not the Pro version. More on those version and the implications in a subsequent blog post, perhaps.
I ran the following command to check my version of git on my AWS EC2 Ubuntu instance.
git --version
I see that I’m using what appears to be an older version:
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ddXmro9VKUMg6CkW2vs_Dg.png)
When I try to update, it tells me that I’m using the latest version. Hmm, that’s not right. My AWS EC2 Ubuntu instance is probably pointed at AWS repositories with versions of software that have been tested to work together, but at the same time, your software packages could possibly be out of date. Upgrading may break dependencies but in this case I don’t really think that it will. I’m going to go ahead and try to update to the latest version of git.
I further inspected the documentation for git on Linux:
I ran this command to add the repository with the latest stable version of git to the repositories my machine uses for updates:
#For Ubuntu, this PPA provides the latest stable upstream Git version
add-apt-repository ppa:git-core/ppa # apt update; apt install git
I ran the following to update packages:
sudo apt-get update
And then upgraded git:
sudo apt-get upgrade git
Then I checked the version again ~ now at 2.40.1
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*U4-W0s5lzND67nYA9ParZA.png)
Not sure why it’s not the same version I saw for Mac.
Also noticed this issue:
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*RxGv5cPoPkeOcKI9x6C5xw.png)
Not going to deal with that right now.
Well, I am at a newer version. I have since used it and it seems to work without any issues for my use case.
Now out of curiousity I headed over to the git downloads page from my Ubuntu instance to see what the latest version of git is for Linux. Turns out it is 2.41.0. For some reason, I’m not getting the latest version from that repository I added. Hmmm….
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*5kdUTUR4iib5154ItzbqHQ.png)
Well that’s odd. There are some solutions here which suggest purging the current version, then reinstalling manually with wget to pull the latest. That’s kind of a hassle I’ll try it.
So I completely removed git:
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*aW7dDTOd0bHxqWe22vGmJQ.png)
Then I started to build git as directed. But what I noticed was that this domain name is not a Github domain, it’s a mirror. Who knows if the source is legitimate.
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*I7u9W1pwlzDfOHBJHesk5g.png)
What other options do we have? Hmm.
Well I can reinstall get and get the latest version of git from GitHub and compile it.
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*b0KsglfqXRTFa_A_zErMxA.png)
And that, my friends…is a topic of a whole other post.
Follow for updates.
Teri Radichel | © 2nd Sight Lab 2023
About Teri Radichel:
~~~~~~~~~~~~~~~~~~~~
⭐️ Author: Cybersecurity Books
⭐️ Presentations: Presentations by Teri Radichel
⭐️ Recognition: SANS Award, AWS Security Hero, IANS Faculty
⭐️ Certifications: SANS ~ GSE 240
⭐️ Education: BA Business, Master of Software Engineering, Master of Infosec
⭐️ Company: Penetration Tests, Assessments, Phone Consulting ~ 2nd Sight Lab
Need Help With Cybersecurity, Cloud, or Application Security?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🔒 Request a penetration test or security assessment
🔒 Schedule a consulting call
🔒 Cybersecurity Speaker for Presentation
Follow for more stories like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
❤️ Sign Up my Medium Email List
❤️ Twitter: @teriradichel
❤️ LinkedIn: https://www.linkedin.com/in/teriradichel
❤️ Mastodon: @teriradichel@infosec.exchange
❤️ Facebook: 2nd Sight Lab
❤️ YouTube: @2ndsightlab
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*H9Ew1KCl-29nZiPR.jpeg)