Connect Xcode Project to Github
Briefly connecting Xcode with your repo at Github.
Create a GitHub Repository:
- Go to GitHub and log in.
- Create a new repository by clicking the “New” button.
Fill in Repository Details:
- Give your repository a name (e.g., “Your Repo”).
- Optionally, add a description.
- Choose public or private visibility.
- Initialize the repository with a README if you want.
Create Repository:
- Click the “Create repository” button.
Copy Repository URL:
- Once your repository is created, copy the repository URL. It should look like
https://github.com/your-username/"your repo ".git
.
Open Xcode Project:
- Open your Xcode project.
Initialize Git in Xcode:
- If your project is not already using version control, you need to initialize Git. Go to Xcode menu -> Source Control -> Create Git Repositories.
“Make sure you can see your project name at your repositories , if you can’t see it let’s add it “

No worries! If you forgot to create a local Git repository for your Xcode project initially, you can follow these steps to initialize Git locally:
- Open terminal on your Mac
- Navigate to your Xcode project directly used cd ex :
cd /path/"to your project "
3. Run the following command to initizalize a git repositroy:
git init
4. add all your files
git add .
5. make an initial commit
git commit -m "initial commit "
Now, you have initialized a local Git Repository for your Xcode Project
“ Restart Xcode “
Lets keep going .
Add Remote Repository URL:
- In Xcode, go to Source Control navigator (usually on the left side).
- Right-click on the project name and select “Add Existing Remote…”
- Paste the GitHub repository URL.

Now add your git repo link here .

Earlier Version of XCode -> 14 or less you will find at your Xcode menu
Xcode menu -> Source control -> Push
Xcode 15 → You will Find , Integrate -> Push

“Becareful to which branch are you pushing lol “

Great , now you can work and commit and push your work , if you got the following error , keep going .
Local Repository is out of Data
We need to pull first then Push , we could do it through terminal or xCode , i will use the terminal .

Ensure that you are at your project
git pull origin main
Replace main with the name of your main branch .
Resolve any merge conflicts that may arise during the pull. Xcode might prompt you to resolve conflicts within the IDE.
After pulling the changes and resolving conflicts, you can proceed to push your changes to the remote repository:
git push origin main
Peew pew pew , Congratz you just connected your project with Github.
Now have fun with commiting and pushing .
If you found this blog helpful or have any questions, feel free to reach out to me on social media:
- YouTube: ElAmir’s YouTube Channel
- Facebook: ElAmir’s Facebook Page
- LinkedIn: Connect with ElAmir on LinkedIn
- Twitter: Follow ElAmir on Twitter
- Udemy: ElAmir’s Udemy Profile
I look forward to connecting with you and exploring more about Enums in Swift together! Thanks for reading.