|
1 | 1 | --- |
2 | | -title: "Using GitHub" |
| 2 | +title: "Using GitHub with a Browser" |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | ## Module Learning Objectives |
@@ -32,21 +32,30 @@ Once you've logged in, you should see something like this: |
32 | 32 |
|
33 | 33 | This landing page has a nice summary of your recent repositories and activity on the left panel. Click on your icon at the top left corner and navigate to your profile. |
34 | 34 |
|
| 35 | +### Your GitHub Profile |
| 36 | + |
| 37 | +Your profile page shows the organizations that you're a part of, as well as a more detailed view of your GitHub contributions/activities over time. There are also tabs at the top that lead you to your repositories, projects, packages, and starred repositories. |
| 38 | + |
| 39 | + |
35 | 40 | <p align="center"> |
36 | 41 | <img src="images/github/github-4-profile-light.png" alt="Screenshot of the landing page on a particular GitHub profile" width="100%"/> |
37 | 42 | </p> |
38 | 43 |
|
39 | | -Your profile page shows the organizations that you're a part of, as well as a more detailed view of your GitHub contributions/activities over time. There are also tabs at the top that lead you to your repositories, projects, packages, and starred repositories. If you would like, you can change your GitHub theme to dark mode by clicking on your icon at the top left corner and going to **Settings** then **Appearances**. For the purposes of this workshop, the rest of the screenshots for the GitHub website will be in dark mode to differentiate it from RStudio. |
| 44 | +If you would like, you can change your GitHub theme to dark mode by clicking on your icon at the top left corner and going to **Settings** then **Appearances**. For the purposes of this workshop, the rest of the screenshots for the GitHub website will be in dark mode to differentiate it from RStudio. |
40 | 45 |
|
41 | 46 | <p align="center"> |
42 | 47 | <img src="images/github/github-5-dark-mode.png" alt="Screenshot of the 'appearance' section of a GitHub user's settings area" width="100%"/> |
43 | 48 | </p> |
44 | 49 |
|
45 | 50 | If there is anything else you would like to change about your account, the user settings page should have it. |
46 | 51 |
|
47 | | -### Looking at a GitHub Repository |
| 52 | +## Looking at a GitHub Repository |
| 53 | + |
| 54 | +To check the repositories that you've created, click on the **Repositories** tab. Note that the top left corner has a green button that will allow you to create new repositories. We will come back to that later. |
48 | 55 |
|
49 | | -To check the repositories that you've created, click on the **Repositories** tab. Note that the top left corner has a green button that will allow you to create new repositories. We will come back to that later. Let's take a closer look at what the ucsb-ds-capstone-2021.github.io repository contains. |
| 56 | +### Repository Content & Structure |
| 57 | + |
| 58 | +Let's take a closer look at what the ucsb-ds-capstone-2021.github.io repository contains. |
50 | 59 |
|
51 | 60 | <p align="center"> |
52 | 61 | <img src="images/github/github-6-my-repos.png" alt="Screenshot of the 'repositories' tab of a user on GitHub" width="100%"/> |
@@ -74,36 +83,37 @@ And finally, if we examine one of the changes made on April 25, we can see exact |
74 | 83 |
|
75 | 84 | The red lines have been deleted while the green lines are new additions. Tracking these changes, and seeing how they relate to released versions of software and files is exactly what Git and GitHub are good for. We will show how they can really be effective for tracking versions of scientific code, figures, and manuscripts to accomplish a reproducible workflow. |
76 | 85 |
|
77 | | -Note: it is possible to edit and add files entirely on the GitHub website, by navigating to the specific file or repository. However, for this workshop, we will be editing and adding files through RStudio instead. |
| 86 | +### Editing a File in GitHub |
| 87 | + |
| 88 | +It is possible to edit and add files entirely on the GitHub website, by navigating to the specific file or repository. To edit an existing file, simply navigate to the file you want to edit (in GitHub), and click the pencil icon above and to the right of the file's contents. |
78 | 89 |
|
79 | 90 | <p align="center"> |
80 | 91 | <img src="images/github/github-10-edit-file.png" alt="Screenshot of a file being viewed in GitHub with a yellow circle around the pencil icon on the top right corner of the file. The pencil has a hovering message above it labeled 'edit this file'" width="100%"/> |
81 | 92 | </p> |
82 | 93 |
|
| 94 | +To add a file, go to the home page of the repository and click the "Add file" dropdown (just to the left of the blue "Code" button) and choose the option that fits your needs. Note that you can only make new files in the 'top level' of the repository or in an existing folder so if you need to make a new folder, you'll need to embrace using GitHub with an IDE (<u>I</u>ntegrated <u>D</u>evelopment <u>E</u>nvironment). |
| 95 | + |
83 | 96 | <p align="center"> |
84 | 97 | <img src="images/github/github-11-add-file.png" alt="Screenshot of a GitHub repository landing page where the 'add file' button has been clicked and a yellow circle surrounds the 'create new file' and 'upload files' buttons in the sub-menu that action created" width="100%"/> |
85 | 98 | </p> |
86 | 99 |
|
87 | | -### Creating a Repository on GitHub |
88 | | - |
89 | | -To stimulate a collaborative GitHub/RStudio workflow, we are going to have 1 person from each group create a new repository on their GitHub account. This will be the repository where everyone shares their files and code. |
| 100 | +## Creating a Repository on GitHub |
90 | 101 |
|
91 | | -To create a new repository, follow these steps: |
| 102 | +You can start the process of making a repository in GitHub. In fact, even if you plan on using GitHub via an IDE (e.g., RStudio, Visual Studio Code, Positron), **we recommend starting the repository in GitHub before continuing to work in your IDE of choice.** |
92 | 103 |
|
93 | | -- Navigate to your profile page and click on the **Repositories** tab. |
94 | | -- Click on <span style="color:green">**New**</span>. |
| 104 | +In order to create a new repository, navigate to your profile page and click on the **Repositories** tab. Once you are there, click the <span style="color:green">**New**</span> button in the upper right corner. |
95 | 105 |
|
96 | 106 | <p align="center"> |
97 | 107 | <img src="images/github/rstudio-1-github-profile.png" alt="Screenshot of the 'repositories' landing page of a particular GitHub user" width="100%"/> |
98 | 108 | </p> |
99 | 109 |
|
100 | | -- Enter a descriptive name for your new repository, here we named it `git-practice` (avoid upper case and use `-` or `_` instead of spaces). |
| 110 | +You will now be prompted to do some setup tasks before the repository can be created. First, choose a descriptive name for your new repository, here we named it `git-practice` but generally you'll want a name that is short while still being descriptive so you can identify its purpose at a glance. Also, it is good practice to avoid uppercase letters and use `-` or `_` instead of spaces. |
101 | 111 |
|
102 | | -- Write a 1-sentence description about the repository content. |
| 112 | +Once you've named your repository, write a 1-sentence description about the repository content. Choose **Public**–this will prevent some easily avoidable access issues down the line. |
103 | 113 |
|
104 | | -- Choose **Public** (as of January 2019, GitHub now offers unlimited free private repositories with a maximum of 3 collaborators). |
| 114 | +Finally, check the box next to "**Add a README file**". This will create a nice file in the top-level of the repository that you can use for high-level documentation. That is extremely useful as a home for any explanation that the repository needs in order to be intelligible to 'future you' or your collaborators. |
105 | 115 |
|
106 | | -- Check **Add a README file**. |
| 116 | +Note that you may want to also add a `.gitignore` using the GitHub template for the code language that you plan to use (see the dropdown menu). This file is described in greater detail elsewhere in this workshop but essentially it is a list of files and folders that you _don't_ want Git to track or that you don't want to upload to GitHub. The coding language templates mostly start by excluding machine-readable files that you don't care about but that your IDE needs to function. |
107 | 117 |
|
108 | 118 | <p align="center"> |
109 | 119 | <img src="images/github/rstudio-3-new-repo-edits.png" alt="Screenshot of the page on GitHub that appears when you click 'new repository'. Contains empty dialogue fields for the repository name and description as well as options for public versus private repositories among other initialization options" width="60%"/> |
@@ -131,9 +141,9 @@ Click on <span style="color:green">**Add people**</span>. Now let's get the user |
131 | 141 | <img src="images/github/rstudio-5b-collabs-4-added-new-user.png" alt="Screenshot of the confirmation message to add a collaborator once they've been selected based on their username or email" width="40%" /> |
132 | 142 | </p> |
133 | 143 |
|
134 | | -Great! Now everyone in the group should have access to the repository. |
| 144 | +Great! Now everyone in the group should receive an invite to access that repository. The invite expires in 24 hours so be sure to send the invite during normal working hours and consider also emailing your team members to let them know they have a time-sensitive invite in whichever email inbox is tied to their GitHub account. |
135 | 145 |
|
136 | | -## Create a Repository on GitHub |
| 146 | +### Practice: Create Your Own Repository |
137 | 147 |
|
138 | 148 | :::callout-note |
139 | 149 | ## Practice |
|
0 commit comments