Skip to main content

This version of GitHub Enterprise was discontinued on 2023-07-06. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Getting changes from a remote repository

You can use common Git commands to access remote repositories.

Options for getting changes

These commands are very useful when interacting with a remote repository. clone and fetch download remote code from a repository's remote URL to your local computer, merge is used to merge different people's work together with yours, and pull is a combination of fetch and merge.

Cloning a repository

To grab a complete copy of another user's repository, use git clone like this:

$ git clone https://HOSTNAME/USERNAME/REPOSITORY.git
# Clones a repository to your computer

You can choose from several different URLs when cloning a repository. While logged in to GitHub, these URLs are available on the main page of the repository when you click Code.

Screenshot of the main page of a repository. A green button, labeled "Code," is outlined in dark orange and expanded to show the HTTPS URL for the repository.

When you run git clone, the following actions occur:

  • A new folder called repo is made
  • It is initialized as a Git repository
  • A remote named origin is created, pointing to the URL you cloned from
  • All of the repository's files and commits are downloaded there
  • The default branch is checked out

For every branch foo in the remote repository, a corresponding remote-tracking branch