Once you have set up a GitLab account in Xcode, you can access GitLab repositories directly from Xcode.
This article explains how to set up a GitLab account in Xcode.
TOC Generate a personal access token
To access GitLab from Xcode, you need a personal access token. Generate a personal access token by doing the following.
Sign in to GitLab, click on your avatar icon in the upper right corner, and select “Edit Profile.
Open the “Edit Profile”
Open “Access Tokens” in “User Settings”.
Open the “Access Tokens”
Enter a name in the “Token name” field such as “Xcode” that identifies the purpose of use.
Enter the expiration date of the token in the “Expiration date” field.
By default, this field is left blank. If left blank, the expiration date will be indefinite.
Set the permissions to be granted in “Select scopes” section.
In my case, I turned on the following permissions, excluding sudo.
Set the permissions to be granted
Click on “Create personal access token.
The generated access token will appear in “Your new personal access token”; copy and save it.
Personal access tokens cannot be redisplayed, so if you lose track of them, please deactivate them and generate a new personal access token.
Setting up an account with Xcode
Set up an account in Xcode.
In Xcode, select “Preferences…” from the “Xcode” menu.
Open the “Accounts” tab.
Click on the “+” button in the lower left corner of the account list.
Add an account
Select “GitLab self-hosted” to connect to the enterprise and community versions of GitLab; select “GitLab.com” to connect to the SaaS version hosted at GitLab.com.
Click the “Continue” button.
Enter the URL in “Server,” the account in “Account,” and the personal access token in “Token,” then click the “Sign In” button.
The “Server” field is only displayed for the Enterprise and Community editions.
Enter connection information
Return to the “Accounts” tab and the account you entered will be added.
An GitLab account is added
This article is part of a series called “How to Use Xcode”. For other articles in the same series, open the following links.
How to Use Xcode Serials List