AI Workshop: learn to build apps with AI →
Git: Working with a remote

Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.


A remote is a clone of your repository, hosted on another machine.

GitHub is one of the most commonly used remotes.

If you have an existing repository, you can publish it on GitHub.

The procedure involves creating a repository on the platform through their web interface, then adding that repository as a remote, and pushing your code there.

To add the remote, type:

git remote add origin https://github.com/YOU/REPONAME.git

An alternative approach is creating a blank repo on GitHub and cloning it locally, in which case the remote is automatically added for you.

Once you’re done, you can push your code to the remote, using the syntax git push <remote> <branch>, for example:

git push origin main

You specify origin as the remote, because you can technically have more than one remote. That is the name of the one we added previously, and it’s a convention.

The same syntax applies to pulling:

git pull origin main

tells Git to pull the main branch from origin, and merge it into the current local branch.

Lessons in this unit:

0: Introduction
1: Installing Git
2: Initialize a repository
3: Commit changes
4: Branches
5: Push and pull
6: ▶︎ Working with a remote
7: Solving conflicts
8: .gitignore
9: How to add a Git remote
10: How to remove a Git remote
11: How to set GitHub credentials for macOS