The following steps can be followed to create a Git repository from an existing XCode project.
- Open the terminal and navigate to the directory containing your XCode project.
- Execute the following commands to create a local Git repository:
> git init
> git add .
- Open your project using XCode.
- Navigate to the menu “Source control” > “your project” > “Configure”.
- Open the “Remotes” tab as shown in the following screenshot.
- Click on the + button.
- Add the remote repository indicating its remote address.
- Now that the remote repository has been configured, we can commit the project. Navigate to “Source control” > “Commit”. You can check the “Push to remote” option or we can do it in two different steps. Click on the Commit button.
- Push the local commit to the remote repository. Navigate to “Source control” > “Push”.