I have the front end app developed in Xcode and the backend logic developed in NodeJS. Therefore I will need to manage 2 independent repositories.
Using GitHub from Xcode 11
If you Xcode project is using local Git, you can create new remote GitHub repository directly in Xcode. Follow this link.
Using GitHub from Mac OS Command Prompt
You need to create an empty private repository in GitHub manually first followed by pushing it from command prompt.
- Create Repository in GitHub manually. Set it to private.
- Copy the clone url. Example: https://github.com/username/project_name.git
- On Mac, open the command prompt and go to the project folder. Ensure that the git user has permission to the repository. Check the user using git config user.name
- Set the origin URL to the new repository. git remote set-url origin https://github.com/username/project_name.git
- If the local git repository doesn't have any existing remote. You can use add. git remote add origin https://github.com/username/project_name.git
- Push to remote. git push -u origin master
- Omit the -u parameter for subsequent push.
If you see this error, you can clear your credential first.
$ git push origin master
remote: Repository not found.
fatal: repository 'https://github.com/username/project_name.git/' not found