-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitcli.sh
More file actions
29 lines (20 loc) · 901 Bytes
/
gitcli.sh
File metadata and controls
29 lines (20 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
# Script to install GitHub CLI (gh) on Ubuntu/Debian-based systems
echo -e "Installing GitHub CLI..."
# Step 1: Add GitHub CLI keyring
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
# Step 2: Set permissions for the keyring
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
# Step 3: Add GitHub CLI repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | su>
# Step 4: Update the package list
sudo apt update
# Step 5: Install GitHub CLI
sudo apt install -y gh
# Step 6: Verify installation
if command -v gh &> /dev/null; then
echo -e "\nGitHub CLI installation complete! Version:"
gh --version
else
echo -e "\nGitHub CLI installation failed."
fi