8 Getting a repository from Github (fork & git clone)

Key terms/commands:

  • Clone: the concept of a “clone” just means to copy the entire repository.

  • Fork: within the context of GitHub, to fork is to copy someone’s GitHub repository and put it in your GitHub account. Under the hood, it is just cloning their repository.

  • git clone: copies (download) a remote repo onto your local computer.

8.1 Fork a repository (remote -> remote)

Fork this repository that hosts this bookdown you are reading into your GitHub.

8.2 Cloning a repository (remote -> local)

Clone YOUR git_github_bookdown repository onto your local computer:

git clone https://github.com/your_username/git_github_bookdown.git ~/git_github_workshop
## Cloning into 'git_github_bookdown'...
## remote: Enumerating objects: 245, done.
## remote: Counting objects: 100% (245/245), done.
## remote: Compressing objects: 100% (136/136), done.
## remote: Total 449 (delta 174), reused 173 (delta 109), pack-reused 204
## Receiving objects: 100% (449/449), 641.16 KiB | 4.16 MiB/s, done.
## Resolving deltas: 100% (291/291), done.

You have cloned someone else’s repository! This is often how collaboration starts through Github.