Managing Git repositories becomes significantly easier with the GitHub Desktop Client, a tool designed for user-friendly interaction and efficient collaboration. This guide will detail how to install GitHub Desktop on Ubuntu 22.04 Jammy Jellyfish or the older stable LTS release Ubuntu 20.04 Focal Fossa. The same method can also be used on short-term releases, provided Ubuntu still supports them.
Key Features of GitHub Desktop Client:
- Cross-Platform Compatibility: Operable on Linux, Windows, and macOS, GitHub Desktop Client is a versatile tool for developers.
- User-Friendly Interface: A clean, intuitive interface simplifies repository management, making it accessible even for Git novices.
- Repository Management: Create, clone, or add existing repositories with ease. The client also facilitates quick switching between multiple repositories and branches.
- Code Review and Collaboration: A built-in diff viewer simplifies code review, and the client supports easy initiation, review, and merging of pull requests.
- Commit and Branch Visualization: Clear visualization features assist in tracking commit history and branching.
- Conflict Resolution: An integrated editor for resolving merge conflicts is included, streamlining this often complex process.
- Keyboard Shortcuts and Extensibility: For enhanced productivity, various keyboard shortcuts are supported, along with customization options.
The GitHub Desktop Client offers comprehensive features to enhance your development workflow. The following guide will provide instructions for installing this valuable tool on Ubuntu.
Table of Contents
Step 1: Update Ubuntu Before GitHub Installation
Before starting the installation process, it’s essential to ensure your system is up-to-date to prevent conflicts. You can do this by using the following command in the terminal:
sudo apt update && sudo apt upgrade
This command updates your system’s package lists and installs any available updates, ensuring you have the latest software installed.
Step 2: Select GitHub Installation Method on Ubuntu 22.04 or 20.04
Method 1: Install GitHub Desktop with .deb Package on Ubuntu 22.04 or 20.04
GitHub currently supports only Windows and macOS by default, but Linux users can access the platform through a project called “shiftkey/desktop.” This Linux fork offers packages for downloading across various Linux distributions.
To get started, navigate to the releases page and obtain the latest release. While the guide recommends installing the “.deb” package, you may also choose to install the appimage if you’re familiar with it and prefer it.
To download the latest release, use the following command in your terminal:
This command downloads and installs version 3.1.7 RC1 as an example. Replace <filename> in the command below with the name of the “.deb” file you’ve downloaded:
sudo dpkg -i <filename>.deb
Example with 3.1.7 RC1:
sudo dpkg -i GitHubDesktop-linux-3.1.7-linux1.deb
For Ubuntu users who may be unfamiliar, dpkg is a package manager used to install, remove, and manage Debian packages. It is a low-level tool for installing .deb packages on your Ubuntu system.
The “-i” flag is a command option instructing dpkg to install the specified package. When using dpkg with the “-i” flag, you provide the filename of the package you want to install as an argument.
Method 2: Install GitHub with APT PPA on Ubuntu 22.04 or 20.04
The second option for installing GitHub Desktop is similar to the first method. Currently, two APT third-party repositories in the United States act as a mirror for the shiftkey/desktop GitHub project. These repositories are recommended and listed on the project’s page. This method is ideal because it allows easy updating of your GitHub Desktop application and other packages. However, some users in other parts of the world may encounter issues connecting to a US mirror. This is not expected to affect the majority of users.
Note, only import one mirror, if it does not work you can safely import the other.
The first one is recommended, but you can use the second one if you encounter any issues.
Import GPG key and repository for @shiftkey:
wget -qO - https://apt.packages.shiftkey.dev/gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/shiftkey-packages.gpg > /dev/null
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/shiftkey-packages.gpg] https://apt.packages.shiftkey.dev/ubuntu/ any main" > /etc/apt/sources.list.d/shiftkey-packages.list'
Alternative mirror by @mwt:
wget -qO - https://mirror.mwt.me/shiftkey-desktop/gpgkey | gpg --dearmor | sudo tee /etc/apt/keyrings/mwt-desktop.gpg > /dev/null
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/mwt-desktop.gpg] https://mirror.mwt.me/shiftkey-desktop/deb/ any main" > /etc/apt/sources.list.d/mwt-desktop.list'
After importing one of the mirrors, it is recommended that you run a quick APT update to ensure that the newly added lists are reflected.
sudo apt update
To install GitHub Desktop, use the following command:
sudo apt install github-desktop
Method 3: Install GitHub Desktop with Flatpak and Flathub on Ubuntu 22.04 or 20.04
The third method to install GitHub Desktop on Ubuntu involves using Flatpak, a powerful utility that simplifies installing and managing Linux applications.
Flatpak provides a secure and isolated environment in which applications can run on your system, offering a range of benefits such as better stability, improved security, and easier management of dependencies.
Enable Flathub Repository on Ubuntu for GitHub Desktop
To use Flatpak, you must enable it on your Ubuntu system by executing a command in your terminal. The command you need to run is as follows:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Install GitHub Desktop via Flatpak on Ubuntu 22.04 or 20.04
Now install Github using the following flatpak command:
flatpak install -y flathub io.github.shiftey.Desktop
This command downloads and installs the GitHub Desktop application, including all necessary dependencies, onto your Ubuntu system.
Step 3: How to Launch GitHub Desktop on Ubuntu 22.04 or 20.04
Now that you’ve successfully installed GitHub Desktop on your Ubuntu system, you can launch it differently depending on how you installed it.
First, if you have your terminal open, you can launch the GitHub desktop client using the following command:
Flatpak users, you can use the following command to launch immediately:
flatpak run io.github.shiftey.Desktop
Alternatively, you can find GitHub Desktop on your desktop by clicking “Activities” and selecting “Show Applications.” This lists all installed applications on your system, including GitHub Desktop. You can click on the application to launch it and start using it for your projects.
After launching GitHub Desktop on your Ubuntu system, you can log in to your account and use the desktop client for your Git purposes.
Select an existing repository or clone a new one to your local machine to get started. You can also use the application to create new branches, commit changes, and push them to your remote repository.
Here are a few tips to help you get started with GitHub Desktop on Ubuntu:
- Use the search feature to find and filter repositories easily.
- Use the commit summary to provide a clear and concise message about your changes.
- Use pull requests to collaborate with others and review code changes before merging.
- Use the branch comparison view to review changes between branches and resolve conflicts.
- Make use of keyboard shortcuts to improve your workflow and save time.
Additional Commands and Tips with GitHub Desktop on Ubuntu
Update GitHub Desktop on Ubuntu 22.04 or 20.04
To update your GitHub Desktop installation on Ubuntu, the process differs slightly depending on whether you installed it via Flatpak, .deb package, or APT.
For Flatpak installations, you can run the following command in the terminal to check for updates:
If you installed GitHub Desktop using the APT mirror, you could run the standard APT update and upgrade commands:
sudo apt update && sudo apt upgrade
However, if you installed GitHub Desktop using the .deb package, you must update it manually. To do this, you can visit the official GitHub Desktop releases page, download the latest .deb package, and install it using the dpkg command.
Remove (Uninstall) GitHub Desktop on Ubuntu 22.04 or 20.04
If you’re no longer interested in having GitHub Desktop installed on your Ubuntu system, you can remove it using a simple command in the terminal.
If you installed GitHub Desktop using the APT package manager, you could use the following command to remove the desktop client:
sudo apt remove github-desktop
If you do not plan to reinstall GitHub using this method again, it is recommended to remove the APT repository. Use the appropriate command based on the repository you imported:
sudo rm /etc/apt/sources.list.d/shiftkey-packages.list
sudo rm /etc/apt/sources.list.d/mwt-desktop.list
For installations using Flatpak, you can use the following command to remove GitHub Desktop, including all its data:
flatpak remove -y --delete-data io.github.shiftey.Desktop
This command ensures that all associated data and configuration files are deleted from your system, freeing up space and ensuring a clean uninstallation.
However, if you installed GitHub Desktop using the .deb package, you’ll need to use the dpkg command to remove it manually. You can use the following command to remove the package:
sudo dpkg -r github-desktop or sudo apt remove github-desktop
This command removes the package from your system but doesn’t delete any associated data or configuration files. If you want to remove these, use the –purge option.
Conclusion and Wrap-up
In conclusion, there are multiple ways to install the GitHub Desktop client on Ubuntu, such as using the .deb local installation, the Shiftkey third-party apt repository, or Flatpak with Flathub. Each method has its advantages, with the .deb local installation providing a direct approach, the Shiftkey apt repository offering seamless updates, and Flatpak with Flathub ensuring sandboxed applications for added security. Ultimately, the choice depends on your preferences and requirements, as all methods provide a reliable and functional GitHub Desktop experience on Ubuntu.