Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ubuntu] Rework Git installation to avoid using apt repo #3095

6 changes: 4 additions & 2 deletions images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ function Get-DockerBuildxVersion {
function Get-GitVersion {
$result = Get-CommandResult "git --version"
$gitVersion = $result.Output | Take-OutputPart -Part 2
return "Git $gitVersion"
$aptSourceRepo = Get-AptSourceRepository -PackageName "git-core"
return "Git $gitVersion (apt source repository: $aptSourceRepo)"
}

function Get-GitLFSVersion {
$result = Get-CommandResult "git-lfs --version"
$gitlfsversion = $result.Output | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
return "Git LFS $gitlfsversion"
$aptSourceRepo = Get-AptSourceRepository -PackageName "git-lfs"
return "Git LFS $gitlfsversion (apt source repository: $aptSourceRepo)"
}

function Get-GitFTPVersion {
Expand Down
17 changes: 14 additions & 3 deletions images/linux/scripts/installers/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh

GIT_REPO="ppa:git-core/ppa"
GIT_LFS_REPO="https://packagecloud.io/install/repositories/github/git-lfs"

## Install git
add-apt-repository ppa:git-core/ppa -y
add-apt-repository $GIT_REPO -y
apt-get update
apt-get install git -y
dibir-magomedsaygitov marked this conversation as resolved.
Show resolved Hide resolved
git --version

# Install git-lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install -y --no-install-recommends git-lfs
curl -s $GIT_LFS_REPO/script.deb.sh | bash
apt-get install -y git-lfs
dibir-magomedsaygitov marked this conversation as resolved.
Show resolved Hide resolved

# Install git-ftp
apt-get install git-ftp -y

# Remove source repo's
add-apt-repository --remove $GIT_REPO
rm /etc/apt/sources.list.d/github_git-lfs.list

# Document apt source repo's
echo "git-core $GIT_REPO" >> $HELPER_SCRIPTS/apt-sources.txt
echo "git-lfs $GIT_LFS_REPO" >> $HELPER_SCRIPTS/apt-sources.txt

#Install hub
tmp_hub="/tmp/hub"
mkdir -p "$tmp_hub"
Expand Down