Russell Gordon

Connecting a Local Repository to a Remote on Your GitHub Account

04 January, 2021

    Your local repository is just that – local.

    When you commit locally changes are saved only on your computer.

    To collaborate with others and allow for things like code review to occur you need to connect your local repository to a remote copy of that repository.

    Once you have a remote, you can push changes from your local repository to the remote repository.

    Creating a New Remote

    Use the keyboard shortcut Command-2 to show the Source Control navigator.

    You may need to expand a blue folder at the top of the navigator.

    Next expand a yellow folder named Remotes.

    Then two-finger tap, or right-click, on the Remotes folder.

    Choose the New ... Remote option.

    NOTE: The name of this menu item will change based on what project you currently have open. Since the current project I have open is named Animation, the option reads as New "Animation" Remote.

    Be sure the account that shows in the Account dropdown is your own GitHub account.

    NOTE: If you don't see your account in the dropdown, be sure you have followed these instructions to create a personal access token for Xcode.

    Set visibility to Public.

    Then change the Remote Name field to origin-mywork.

    Other settings can be left at their default values.

    Finally, press the Create button.

    After a moment, the code on your local computer is pushed up to, and you're all set.