Git lets you track and synchronize files between a local folder on your computer and another folder somewhere on a server. Usually, this faraway server folder is called a “remote” repository. In git conventions and traditions, this faraway reference remote is often called “origin”.
Here is the command to add or reference this with git.
- Using the terminal, navigate to the folder on your local computer that you want to synchronize with the remote one.
- If it’s already got some type of tracking set up, you need to follow a different command to change the existing origin remote on git. Adding a new remote with the same name won’t work.
- If you’re setting up your “origin” remote for the first time in a given git folder, type the following command:
git remote add origin https://github.youroriginrepositoryurl
Typically, you use this command and procedure when setting up a local environment to develop a wordpress website that is already up and running. Local tools such as VVV create a server and pre-create a placeholder website in the process. Then, when the local server is up and running, you can swap out the placeholder website with your actual working website, for which you’ve already got a repository that’s being tracked somewhere, like github or gitlab.