After setting up a GitLab account in Xcode, you can directly access GitLab repositories 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. Follow these steps to generate a personal access token.
STEP
Sign in to GitLab, click on your avatar icon in the upper right corner, and select “Edit Profile.
Open the “Edit Profile”
STEP
Open “Access Tokens” in “User Settings”.
Open the “Access Tokens”
STEP
Enter a name in the “Token name” field, such as “Xcode” that identifies the purpose of use.
STEP
Enter the token’s expiration date in the “Expiration date” field.
By default, this field is left blank. If left blank, the expiration date will be indefinite.
STEP
Set the permissions to be granted in the “Select scopes” section.
In my case, I turned on the following permissions, excluding sudo.
api
read_user
read_api
read_repository
write_repository
Set the permissions to be granted
STEP
Click on “Create personal access token”.
STEP
The generated access token will appear under “Your new personal access token”. Ensure to copy and save it.
Remember, personal access tokens cannot be redisplayed. If lost, deactivate the old token and generate a new one.
Setting up an account with Xcode
Follow the steps below to set up an account in Xcode.
STEP
In Xcode, select “Preferences…” from the “Xcode” menu.
STEP
Open the “Accounts” tab.
STEP
Click on the “+” button in the lower-left corner of the account list.
Add an account
STEP
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.
Select GitLab
STEP
Click the “Continue” button.
STEP
Enter the URL in “Server,” the account in “Account,” and the personal access token in “Token,” then click the “Sign In” button.
Only the Enterprise and Community editions display the ” Server ” field.
Enter connection information
STEP
Once you return to the “Accounts” tab, you should see the account you entered added to the list.
An GitLab account is added
Serials List
This article is part of a series called “How to Use Xcode”. For other articles in the same series, open the following links.