-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path06_sharing_results_08_git_projects.Rmd
More file actions
93 lines (52 loc) · 5.94 KB
/
Copy path06_sharing_results_08_git_projects.Rmd
File metadata and controls
93 lines (52 loc) · 5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
```{r, include = FALSE}
ottrpal::set_knitr_image_path()
```
# Setting Up a Project on GitHub
Having learned how to organize a data science projects in the last course and how to navigate GitHub and git commands in this course, in this lesson, we'll put all of this together and walk through setting up an example project and pushing the content to GitHub.
### Setting up a GitHub Repository
First things first, we need to create a new repository. We'll do this as discussed in the "Creating A Repository Lesson," by going to [GitHub](www.github.com), logging in to your account, and creating a new repository.

You can also create a new repository by clicking on the plus sign in the top right corner of GitHub homepage and clicking on "New repository".

On the page that follows, type the repository name. Choose the name `my_first_project`, add a description if you wish (always recommended), make it public, and choose to initialize with a README file. At the end click on the button Create repository.

The next step is to clone this repository into Posit Cloud but as you may remember, we first need the url to this repository we just created. On the repository page, click on Clone or download and copy the link address. Make sure the address starts with `https` rather than `git`. If it starts with `git`, click on Use HTTPS on the corner of the small window to have the link starting with `https`.

### Creating a New Project from a GitHub Repository
Ok, now that we have everything set up on the GitHub end, Go to [Posit Cloud](https://posit.cloud/) and login with your account. When you're redirected to your Projects page, Next to the New Project button, click on the drop down button and then click on New Project from Git Repo.

On the popup window, paste the repository url that you just copied and click Ok.

This will automatically clone the remote repository and create a new project on Posit Cloud. Note that the repository is still unnamed so you may want to change the name to something else. If you click on the README file under Files, you will see that the README file contains the description you added on the GitHub website.

Start editing the README file. Specifically, replace the content with the following lines.
```text
# This is the README file for my_first_project
The folders in this project are:
* _data_ - is the folder where you will put all the data you have collected or been given to analyze.
* _figures_ - is where you will put plots, data pictures, and other images you have created to show data to other people.
* _code_ - is where you will create code files for collecting, cleaning up, or analyzing data.
* _products_ - this is the place where you will place any reports, presentations, or products you create for sharing with other people.
```
### Pushing Local Changes to the Remote Repository in Posit Cloud
In the previous chapter we discussed how to add local changes to GitHub, but we will practice this again here.
In brief, here's the steps we need to do.
1. Check the boxes next to the file changes we want to keep
2. Click the commit button.
3. With the `usethis` package us the `pr_push()` function.
You should be able to see your changes on the repository on GitHub.com.

We have learned about the importance of organization and folder structure in data science projects. Let's practice creating the main folders required in a data science project. As you may remember, these folders represent the four parts of any data science project: data, figures, code, and products. Let's create them on Posit Cloud.

Now go ahead and further create the folder structure that we learned. An important note is that if you push the changed you created in the project to GitHub, you won't see the folder structure that you created. Unfortunately, a folder structure won't be pushed to GitHub unless the folders contain at least a file. So don't worry. Once you populate this project with your data, code, figures, and writings and push them to GitHub you will see the folders your just created.
* data/
* raw_data/
* tidy_data/
* code/
* raw_code/
* final_code/
* figures/
* exploratory_figures/
* explanatory_figures/
* products/
* writing/