Difficulty: Beginner
Estimated Time: 10 minutes

In this scenario you'll learn how you can share the changes in your repository with other people and combine their changes into your repository. This environment has been configured with a Git repository with a single commit. A remote repository is configured but has not been linked to the local repository.

With Git being a distributed version control system it means the local repository contains all the logs, files and changes made since the repository was initialised. To ensure that everyone is working on the most recent version changes need to be shared. When sharing these changes with other repositories only the differences will be synced making the process extremely fast.

This scenario demonstrated how you can push / pull changes between different repositories. By continually using git push and git pull you can ensure everyone has access to the latest version of the code base.

This scenario has been added to your scrapbook where you can review the examples and commands you executed.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Scenario 3 - Working Remotely

Step 1 of 5

Step 1 - Git Remote

Remote repositories allow you to share changes from or to your repository. Remote locations are generally a build server, a team members machine or a centralised store such as Github.com. Remotes are added using the git remote command with a friendly name and the remote location, typically a HTTPS URL or a SSH connection for example https://github.com/OcelotUproar/ocelite.git or [email protected]:/OcelotUproar/ocelite.git.

The friendly name allows you to refer to the location in other commands. Your local repository can reference multiple different remote repositories depending on your scenario.

Task

This environment has a remote repository location of /s/remote-project/1. Using git remote, add this remote location with the name origin.

Protip

If you use git clone, discussed in a future scenario, then the location you're cloning from will be automatically added as a remote with the name origin.