How to create a remote GitHub repository from Xcode
A feature not obvious to me (and maybe to you!)
Hi everyone! As a part of my content creation work, I often need to develop apps to showcase various functionalities for my articles and videos. This requires me to create new git repositories and push them remotely regularly.
Previously, I used to create remote repositories directly from GitHub and push my projects there. There's nothing wrong with that, but it turns out that you can make a remote repository for your app directly from Xcode.
In today's article, I want to share a step-by-step guide on how to do it. I don't know about you, but it is complicated for me to remember the steps each time I need them.
This started as a guide for me, but maybe I'm not the only one with this issue, so here I am helping you π!
This tutorial was created using Xcode 15. Also, it can work to set up remote repos on GitLab and Bitbucket!
Step 1: Preconditions
A GitHub account. If you donβt already have a GitHub account, you must create one at GitHub's website.
Add GitHub credentials to Xcode. Go to Xcode > Settings > Accounts and add a GitHub account:
There are multiple ways to sign it. I prefer using a personal access token through HTTPS. If you want to learn more, please check out this link.
Step 2: Create a Local Repository
There are two ways to do this: one for new projects and another for already created projects. I will cover both!
New Projects
Click the "Next" button after typing your project's name:
Check "Create Git repository on my Mac":
Existing Projects
For existing projects, go to Integrate > "New Git Repository":
And click "Create":
Notice how Xcode is showing the respective repository and branch in the Navigator (left) bar:
Before:
After:
Step 3: Create the remote repository
Go to "Source Control" In the Navigator bar, expand the repository and right-click on "Remotes":
I don't know why this option is too hard to find in the UI (and yes, that's why my face). Apple, please make it more accessible!
Now fill out and review the configuration for the new remote repo you are about to create:
Click "Create", and boom! Your new remote repo has been created on GitHub! π
Wrap up
As you can see, creating remote GitHub repositories is super simple on Xcode (the problem is finding the option π).
Would you like to learn more about Xcode tips and tricks? Please let me know in the comments down below.
This week, I decided to take a break and publish a shorter article because the previous one was quite controversial π₯.
Remember, My name is Pitt, and this... this is swiftandtips.com! Thanks for reading, and have a great day! ππ»