Skip to content

Commit

Permalink
Update Cloning_a_Github_repo.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mgimond authored Mar 2, 2024
1 parent ba9bc9c commit d83546b
Showing 1 changed file with 22 additions and 37 deletions.
59 changes: 22 additions & 37 deletions Cloning_a_Github_repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,55 +43,40 @@ The repo page will normally have a README file with instructions on how to tackl

3. In your web browser, navigate to the Github/repo page you want to clone. (Note that if you are given a link to a **GitHub Classroom** assignment, you will use that link instead and this as well as the next two steps).

4. Click on the *Code* button. This will reveal the full web path to your repo.
4. Click on the *Code* button. This will reveal the full web path to your repo. Copy that full path by either selecting it and copying it, or by clicking on the icon to its right.

<img src="img/github_repo_link.png" width="700px" hspace="50"/>
<img src="img/github_repo_link.png" width="500px" hspace="50"/>

5. In your git shell, clone the repo by typing the link from the Github page. Make sure that the full link is copied (the last element of the link should end with `*.git`). For example, if the link is `https://github.com/jdcolby/repo1.git`, type:
> NOTE: Before proceeding, if this is the first time you are cloning from your GitHub account to your local computer, you will need to create and install a token following instructions outlined on [this page](authenticating_with_github.md). **Keep the Token window open!** You will need to copy and paste that token in later steps.
5. In your git shell, clone the repo by typing the link from the Github page. Make sure that the full link is copied (the last element of the link should end with `*.git`). For example, if the link is `https://github.com/Colby-es218-2024/sample-jdcolby.git`, type:

```{r}
git clone https://github.com/jdcolby/repo1.git
git clone https://github.com/Colby-es218-2024/sample-jdcolby.git
```

6. **If this is your first time cloning from your GitHub repo**, you will be asked fro your GitHub user name.

```r
$ git clone https://github.com/Colby-es218-2024/sample-jdcolby.git
Cloning into 'sample-jdcolby'...
Username for 'https://github.com':
```
Type your GitHub username and press enter.

You will then be prompted to enter a paswword. But, this will not be your regular GitHub password. Instead, you will paste the PAT token you created for the machine you are working on.

6. If this is the first time you download a repo from GitHub on the computer you are working on, you may be presented with a **GitHub Sign in** window. If so, select the **Token** option.
Note that for **Windows**, you might be presented with a **GitHub Sign in** window. If so, select the **Token** option.

<img src="img/sign_in_token.png" width="359px" hspace="50"/>
<img src="img/sign_in_token.png" width="359px" hspace="50"/>

In the Token field, paste the PAT token you created for the machine you are working on (following steps outlined in a [separate tutorial](https://mgimond.github.io/intro_to_git/authenticating_with_github.html)).
In the Token field, paste the PAT token you created for the machine you are working on.

At this point, you have a clone (copy) of the repo content on your computer.
8. At this point, you have a clone (copy) of the repo content on your computer.

<img src="img/local_repo_folder.PNG" width="400px" hspace="50"/>

To see the contents of the `repo1/` folder from the terminal, `cd` into that folder as follows:

```
cd repo1
```

then list the folder's contents:

```
ls
```

You should see the README.md file created up on GitHub in that folder.

Note that the `repo1` folder also contains a hidden folder called `.git`. To see it, add the `-a` option as follows:

```
ls -a
```

Your terminal window should now display:

```
. .. .git README.md
```

It's important that you do not delete the `.git` folder.

You can now create/edit files in your project folder as needed. Be sure to save all project files in the cloned repo folder.
9. You can now work in this folder as you would with any other assigment folder. When you have completed your assignment, be sure to save all files (R scripts, etc...) before submitting the assignment to GitHub. You can find these instructions on submitting yout assignment [here](stage_and_push.md).

-----

Expand Down

0 comments on commit d83546b

Please sign in to comment.