Synchronizing the repository with a remote server
Up to now, we have learned how to create a local Git repository and add or update files to it. In this recipe, we will learn how to set up a remote repo and synchronize local code with it. We will be using GitHub to host our remote repository; feel free to choose any other code hosting service.
Getting ready
You will need a GitHub account. Sign up for a free account if you do not already have one.
How to do it…
To create a new repository on GitHub, log in to your GitHub account and create a new public repository:
Click the Create repository button. Make sure that the checkbox Initialize this repository with a README is unchecked. The new repository form should look something like this:
On the next page, you will be given an option to initialize this repository. We already have a local repository, so we will use the ... or push an existing repository from the command line option:
Copy both commands and execute them on a local Git repository:
$ git...