Starting developing in Swift: setting up version control with GitLab

Now that I have received my grade for the second part of the Coursera iOS with Swift specialisation I decided it is time to get started to build my own app. The first thing to do (as a professional developer ;-)) is to configure my versioning control in XCode.
Since I have pretty good experiences with Git I decided to setup a GIT repository to use. Normally I would use GitHub for this but since I want to have a free private repository I decided to use GitLab. In the past I have setup my own server running GitLab CE but for now I stay with the free hosting on the server. After creating an account and signing in into it is just running the commands as shown on the GitLab site when you create your first project. But before I do that I set up the SSH key on my MacBook first so I can use the SSH protocol with GitLab.

To setup a new SSH key on a Mac perform the following commands in your Terminal.
Go to your home directory:

cd ~/

Generate the SSH key:

ssh-keygen -t rsa

Copy the content of the created key to your clipboard:

cat ~/.ssh/ | pbcopy

Go to your profile on and choose the menu option ‘SSH Keys’. Click on ‘Add SSH KEY’ and paste the clipboard content in the ‘key’ field. Enter a name for the key and you are ready to use HTTPS for your GitLab interactions.

When that is done I can create my project in GitLab:
Screenshot at Dec 03 20-52-52
Just fill in the details and click ‘Create’. This will take you to the ‘Project’ page showing you the commands you can perform on your Mac to ‘clone’ the project to your local system:
Screenshot at Dec 03 20-56-16
Performing these commands in your Terminal should give you the following result:
Screenshot at Dec 03 21-01-05

If you now refresh the page in GitLab you should see that there has been one commit:
Screenshot at Dec 03 21-02-39
This makes sure the basics of GIT are working. Now it is time to implement the Git Flow as I mentioned in a previous post.

To install the Git Flow just run the command ‘brew install git-flow’. When that is finished just run the command ‘git flow init’ in your project to get started with Git Flow (creating necessary branches etc). To push the created branch to the GitLab sever use ‘git push –all -u’. Here you see how it should look like:
Screenshot at Dec 03 21-09-01
In GitLab we now see two branches for our project:
Screenshot at Dec 03 21-10-49
So now we are able to create a remote project and use that in our Terminal on the Mac. In the next post I will dive into the combination of GitLab, XCode and Git Flow.

About Pascal Alma

Pascal is a senior software developer and architect. Pascal has been designing and building applications since 2001. He is particularly interested in Open Source toolstack (Mule, Spring Framework, JBoss) and technologies like Web Services, SOA and Cloud technologies. Lately he is having great fun by building iOS apps with Swift. Specialties: JEE AWS XML/XSD/XSLT Web Services/SOA Mule ESB/ WSO2 ESB Maven Cloud Technology Swift/ iOS
This entry was posted in Git, Swift and tagged , , . Bookmark the permalink.

2 Responses to Starting developing in Swift: setting up version control with GitLab

  1. Pingback: Starting developing in Swift: Using GitLab with XCode | The Pragmatic Integrator

  2. Pingback: Starting Developing in Swift: Using GitLab with XCode -

Comments are closed.