In this article, we are going to instruct how to clone the GoDevTips repository locally in Ubuntu. This is important when you want to run codes from one of our articles. At the end of this article you will have a Git client software installed, the repository cloned and able to run Go codes provided from an article.
Installing Git in Ubuntu
Before any Git tasks can be performed, you must install Git on your mac. This is a very simple procedure just enter the following command in terminal:
sudo apt install git
To verify if git is successfully installed, just enter the following the command in terminal:
Git client software
In Ubuntu, Git client software is very limited and we are going to use GitKraken. This Git client software can be downloaded from their official webpage.
Once the installation succeeded, GitKraken appears in the list of applications.
You can launch GitKraken by selecting it from the application list.
After launching GitKraken, on the welcome screen you will be asked to log in with a GitHub account or create a GitKraken account. For this example, we are going to use our already created GitHub account. After logging in with the selected account, the next procedures follow:
Cloning the repository
Before the GoDevTips repo can be cloned, you need to copy the clone URL from GitHub.
From the GitKraken main screen select Clone a repo, select the Clone option and select the Clone with URL option. From this step fill the repository clone properties and click on Clone the repo. After the repository is cloned, a dialog appears indicating the repository has been successfully cloned locally.
Opening the repository in GitKraken
To open the repository in GitKraken, just follow the steps described below:
Opening the repository in Code editor
Open the repository in GitKraken is great to keep track of our commits, branches and new code examples as we commit and publish them. Once you successfully cloned the repository, you can just open the golangExercise folder in your selected code editor. In this example, we are going to open this folder in Atom, although the procedure is identical through all the other code editors.
Running the project
For this example, we are going to run the multiReturn project. Ones the project is imported, open the
main.go file and enable the terminal in order to navigate to the file.
To navigate to the file, enter the following command:
And to run this project:
go run main.go