How to Install Sourcetree on Ubuntu
Last Updated :
14 Oct, 2024
Managing repositories and tracking changes can sometimes be overwhelming, but with Sourcetree, developers can simplify version control and boost productivity. In this article, we will be installing the Sourcetree application on the Ubuntu system in a step-by-step process.
What is Sourcetree?
Sourcetree is a GUI-based Git and Mercurial client application for managing and organizing repositories. Sourcetree provides a user-friendly GUI for performing various Git and Mercurial operations like pull, merge, commit, push, etc. Sourcetree application is open-source and available on various platforms including Windows, Mac, and Linux. Ultimately, Sourcetree is a powerful tool that enhances the productivity of developers and streamlines their workflow.
Installing Sourcetree on Ubuntu
Follow the below steps to install the Sourcetree application on the Ubuntu system without facing any issues.
Step 1: Update Your Ubuntu System
Firstly, update the system to refresh the package manager index cache. Execute the below command in the terminal to update the system using apt manager.
sudo apt update
Step 2: Install Wine on Ubuntu
As we know SourceTree is not directly available for Linux, therefore to install it we are using Wine on Linux. So using the below command, we can download Wine on the system. Run the command to install wine.
wget -nc https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
Install Wine on UbuntuStep 3: Move Wine Configuration File to Sources Directory
After installing Wine, we will move the repository configuration file of Wine to the sources.list.d directory.
sudo mv winehq-jammy.sources /etc/apt/sources.list.d/
Move Wine Configuration File to Sources DirectoryStep 4: Create a Keyrings Directory
Now, we will create a keyrings directory with specific permissions. Execute the below command, to create the directory in the /etc/apt directory.
sudo mkdir -pm755 /etc/apt/keyrings
Create a Keyrings DirectoryStep 5: Download WineHQ GPG Key
Now, we will download the GPG key for the WineHQ repository and will save it in the keyrings directory that we have created in the above step.
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
Download WineHQ GPG KeyStep 6: Install WineHQ Staging
By using the below command, we will install the WineHQ Staging package on the Ubuntu system along with the recommended packages that are needed for it to work properly.
sudo apt install --install-recommends winehq-staging
Install WineHQ StagingStep 7: Download Sourcetree for Windows
Visit the below site, to download the Sourcetree tool as it is not available as the Debian library, we will download the executable binary available for Windows.
https://www.sourcetreeapp.com/
Step 8: Launch Sourcetree Installation Using Wine
After downloading the file using the web browser, it will be shown in the Downloads directory. We can launch the application for configuration from the terminal itself. Execute the below command in the terminal to launch the application for config.
wine ~/Downloads/SourceTreeSetup-*.exe
Launch Sourcetree Installation Using WineConfiguring Sourcetree on Ubuntu
After launching the installer, follow the steps below to complete the setup of Sourcetree on your Ubuntu system.
Step 1: Run the Sourcetree Installation Wizard
Once you have launched the application, you will see the Installation Wizard of Sourcetree as shown in the below screenshot. You can connect to the BitBucket otherwise, you can skip the process and move forward.
Run the Sourcetree Installation WizardStep 2: Install Git and Mercurial Tools
As Sourcetree supports Git and Mercurial applications, we can install any of them or both. Just click on the tools to install and click Install.
Install Git and Mercurial ToolsStep 3: Set Up Your Username
After downloading, you will see the success message as shown below screenshot. You can click on the Next button to set your username.
Set Up Your UsernameStep 4: Finish the Installation
After clicking on the Next button, the application will choose an automatic username for you. You can rename the username as per your wish. After setting the username, you can click on Next to enter the application for usage.
Finish the InstallationStep 5: Successful installation
Below you can see that, we have successfully installed and configured the Sourcetree application on Ubuntu without facing any error while installing.
Conclusion
Although Sourcetree is primarily built for Windows and macOS, Linux users can still enjoy its benefits by using Wine. With Sourcetree, developers can manage version control, collaborate more effectively, and improve their productivity—all from a single, user-friendly application.