├── .github
└── workflows
│ └── publish.yml
├── .gitignore
├── CITATION.cff
├── Introduction-RStudio-Git-GitHub.Rproj
├── LICENSE-CODE.md
├── LICENSE.md
├── README.md
├── SSH.qmd
├── _quarto.yml
├── analysis_start.qmd
├── assets
├── GitHub-remote.png
├── LMU-OSC_favicon.jpg
├── LMU-OSC_logo.jpg
├── add-ssh-key.png
├── commit.png
├── file_list.png
├── first_commit.png
├── first_push_confirm_identity.png
├── git_changed.png
├── git_commit_message.png
├── git_commit_message2.png
├── git_commit_message3.png
├── git_diff.png
├── git_history_tab.png
├── git_history_tab_filter.png
├── git_history_tab_filter_example.png
├── git_more_shell.png
├── git_pane.png
├── git_pane_added.png
├── git_push.png
├── github_git_commands.png
├── my_new_repo_name.png
├── new_repo.png
├── new_repo_name.png
├── project_files.png
├── project_screen1.png
├── project_screen2.png
├── project_screen3.png
├── readme_commit.png
├── ssh-key.png
└── staged_readme.png
├── commit.qmd
├── custom.scss
├── github.qmd
├── github_sync.qmd
├── index.qmd
├── installing_git.qmd
├── installing_software.qmd
├── making_change.qmd
├── matomo_analytics.html
├── next_steps.qmd
├── rstudio_project.qmd
├── styles.css
├── updates.qmd
├── version_control.qmd
└── viewing_history.qmd
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | on:
2 | workflow_dispatch:
3 | push:
4 | branches: main
5 |
6 | name: Quarto Publish
7 |
8 | jobs:
9 | build-deploy:
10 | runs-on: ubuntu-latest
11 | permissions:
12 | contents: write
13 | steps:
14 | - name: Check out repository
15 | uses: actions/checkout@v4
16 |
17 | - name: Set up Quarto
18 | uses: quarto-dev/quarto-actions/setup@v2
19 |
20 | - name: Install R
21 | uses: r-lib/actions/setup-r@v2
22 | with:
23 | r-version: '4.4.0'
24 |
25 | # - name: Install R Dependencies
26 | # uses: r-lib/actions/setup-renv@v2
27 | # with:
28 | # cache-version: 1
29 |
30 | - name: Render and Publish
31 | uses: quarto-dev/quarto-actions/publish@v2
32 | with:
33 | target: gh-pages
34 | env:
35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # History files
2 | .Rhistory
3 | .Rapp.history
4 |
5 | # Session Data files
6 | .RData
7 | .RDataTmp
8 |
9 | # User-specific files
10 | .Ruserdata
11 |
12 | # Example code in package build process
13 | *-Ex.R
14 |
15 | # Output files from R CMD build
16 | /*.tar.gz
17 |
18 | # Output files from R CMD check
19 | /*.Rcheck/
20 |
21 | # RStudio files
22 | .Rproj.user/
23 |
24 | # produced vignettes
25 | vignettes/*.html
26 | vignettes/*.pdf
27 |
28 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
29 | .httr-oauth
30 |
31 | # knitr and R markdown default cache directories
32 | *_cache/
33 | /cache/
34 |
35 | # Temporary files created by R markdown
36 | *.utf8.md
37 | *.knit.md
38 |
39 | # R Environment Variables
40 | .Renviron
41 |
42 | # pkgdown site
43 | docs/
44 |
45 | # translation temp files
46 | po/*~
47 |
48 | # RStudio Connect folder
49 | rsconnect/
50 |
51 | # Quarto
52 | /.quarto/
53 |
54 | # Future-proofing: ignore commonly included files that should not be tracked
55 | # Inspired by usethis::git_vaccinate() options
56 | .DS_Store
57 | .Rproj.user
58 | .httr-oauth
59 | .quarto
60 | _site/
61 |
--------------------------------------------------------------------------------
/CITATION.cff:
--------------------------------------------------------------------------------
1 | cff-version: 1.2.0
2 | message: "If you use this software, please cite it as below."
3 | authors:
4 | - family-names: "Croucher"
5 | given-names: "Mike""
6 | affiliation: "Community Developer Advocate, MathWorks"
7 | title: "Introduction to version Control with git and GitHub within RStudio"
8 | version: 1.0.0
9 | doi:
10 | date-released: 2016-09-03
11 | repository-code: "https://github.com/lmu-osc/Introduction-RStudio-Git-GitHub"
12 | url: "https://github.com/lmu-osc/Introduction-RStudio-Git-GitHub"
13 |
--------------------------------------------------------------------------------
/Introduction-RStudio-Git-GitHub.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: knitr
13 | LaTeX: pdfLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 |
--------------------------------------------------------------------------------
/LICENSE-CODE.md:
--------------------------------------------------------------------------------
1 | # Creative Commons Zero v1.0 Universal
2 |
3 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
4 |
5 | ### Statement of Purpose
6 |
7 | The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
8 |
9 | Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
10 |
11 | For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
12 |
13 | 1. __Copyright and Related Rights.__ A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
14 |
15 | i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
16 |
17 | ii. moral rights retained by the original author(s) and/or performer(s);
18 |
19 | iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
20 |
21 | iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
22 |
23 | v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
24 |
25 | vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
26 |
27 | vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
28 |
29 | 2. __Waiver.__ To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
30 |
31 | 3. __Public License Fallback.__ Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
32 |
33 | 4. __Limitations and Disclaimers.__
34 |
35 | a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
36 |
37 | b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
38 |
39 | c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
40 |
41 | d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
42 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # Creative Commons Attribution-ShareAlike 4.0 International
2 |
3 | Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
4 |
5 | **Using Creative Commons Public Licenses**
6 |
7 | Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
8 |
9 | * __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
10 |
11 | * __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
12 |
13 | ## Creative Commons Attribution-ShareAlike 4.0 International Public License
14 |
15 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
16 |
17 | ### Section 1 – Definitions.
18 |
19 | a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
20 |
21 | b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
22 |
23 | c. __BY-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License.
24 |
25 | d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
26 |
27 | e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
28 |
29 | f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
30 |
31 | g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
32 |
33 | h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
34 |
35 | i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
36 |
37 | j. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
38 |
39 | k. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
40 |
41 | l. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
42 |
43 | m. __You__ means the individual or entity exercising the Licensed Rights under this Public License. __Your__ has a corresponding meaning.
44 |
45 | ### Section 2 – Scope.
46 |
47 | a. ___License grant.___
48 |
49 | 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
50 |
51 | A. reproduce and Share the Licensed Material, in whole or in part; and
52 |
53 | B. produce, reproduce, and Share Adapted Material.
54 |
55 | 2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
56 |
57 | 3. __Term.__ The term of this Public License is specified in Section 6(a).
58 |
59 | 4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
60 |
61 | 5. __Downstream recipients.__
62 |
63 | A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
64 |
65 | B. __Additional offer from the Licensor – Adapted Material.__ Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
66 |
67 | C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
68 |
69 | 6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
70 |
71 | b. ___Other rights.___
72 |
73 | 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
74 |
75 | 2. Patent and trademark rights are not licensed under this Public License.
76 |
77 | 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
78 |
79 | ### Section 3 – License Conditions.
80 |
81 | Your exercise of the Licensed Rights is expressly made subject to the following conditions.
82 |
83 | a. ___Attribution.___
84 |
85 | 1. If You Share the Licensed Material (including in modified form), You must:
86 |
87 | A. retain the following if it is supplied by the Licensor with the Licensed Material:
88 |
89 | i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
90 |
91 | ii. a copyright notice;
92 |
93 | iii. a notice that refers to this Public License;
94 |
95 | iv. a notice that refers to the disclaimer of warranties;
96 |
97 | v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
98 |
99 | B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
100 |
101 | C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
102 |
103 | 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
104 |
105 | 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
106 |
107 | b. ___ShareAlike.___
108 |
109 | In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
110 |
111 | 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
112 |
113 | 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
114 |
115 | 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
116 |
117 | ### Section 4 – Sui Generis Database Rights.
118 |
119 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
120 |
121 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
122 |
123 | b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
124 |
125 | c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
126 |
127 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
128 |
129 | ### Section 5 – Disclaimer of Warranties and Limitation of Liability.
130 |
131 | a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
132 |
133 | b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
134 |
135 | c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
136 |
137 | ### Section 6 – Term and Termination.
138 |
139 | a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
140 |
141 | b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
142 |
143 | 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
144 |
145 | 2. upon express reinstatement by the Licensor.
146 |
147 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
148 |
149 | c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
150 |
151 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
152 |
153 | ### Section 7 – Other Terms and Conditions.
154 |
155 | a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
156 |
157 | b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
158 |
159 | ### Section 8 – Interpretation.
160 |
161 | a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
162 |
163 | b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
164 |
165 | c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
166 |
167 | d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
168 |
169 | > Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the [CC0 Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/legalcode). Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
170 | >
171 | > Creative Commons may be contacted at creativecommons.org.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Introduction to version control with Git and GitHub within RStudio
2 |
3 | ## About this work
4 |
5 | This work was originally created by [Mike Croucher](https://github.com/mikecroucher) from [RSE-Sheffield](https://github.com/RSE-Sheffield) under a [Creative Commons Attribution Share Alike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/legalcode). The [original repository](https://doi.org/10.5281/zenodo.61435) was created for a workshop organised by Malika Ihle at the International Society for Behavioural Ecology conference in 2016. It was subsequently adapted by Malika for [Reproducible Research Oxford](https://ox.ukrn.org/). It is now maintained by [Malika Ihle](https://www.osc.uni-muenchen.de/about_us/coordinator/index.html) for the [LMU Open Science Center](https://www.osc.uni-muenchen.de/index.html). The overview image is from [Dumitru Uzun](https://duzun.me/tips/git). You are free to use this work in your own projects.
6 |
7 | ## Before the session
8 | Please watch this 10 min introductory [videorecording](https://osf.io/dcqt9/).
9 |
10 | ## Overview of the exercice
11 | In this session, you are going to start using the version control system Git from within RStudio to keep your local workflow tidy while having access to all previous versions of your files. You will then backup your workflow online on a remote GitHub server, which will allow you to access your work from any computer, and sharing it with your collaborators or publically. Specifically, you will
12 | * install and configure Git (as well as R and RStudio if needed), and create a GitHub account
13 | * create a local RStudio project under version control
14 | * make changes and **commit** them to your local repository (i.e. save your changes locally in your version control system)
15 | * connect your local repository to your GitHub account by creating a remote GitHub repository and setting it as the 'origin' of your local repository from the command line (this is the procedure you will have to follow to 'upgrade' your former RStudio projects that were not under version control and backed-up on GitHub; but in the future, I recommend you first create a GitHub repository (your remote origin) and then **clone** it locally (i.e. copy it to your computer while maintaining a connection to your remote (GitHub) version). This procedure, easily done from RStudio, will be covered in the [second workshop](https://lmu-osc.github.io/Collaborative-RStudio-GitHub/))
16 | * **push** your local changes to your remote repository (i.e. synchronise your changes to your GitHub version)
17 |
18 | Once this workflow is set up, you can easily work with several computers or with collaborators: if you have changes in your GitHub version (if you or a collaborator pushed changes from another computer or if you made changes online, directly on GitHub), you can **pull** them into your local version (i.e fetch changes and merge them locally, to keep your copy up-to-date).
19 |
20 |
21 |
22 |
23 |
24 | ## Step-by-step tutorial
25 | The material is self-paced and includes a worked-example. It is necessary that you work through the sections in order.
26 |
27 | * [Installing R and RStudio](./installing_software.qmd)
28 | * [Installing and configuring Git](./installing_git.qmd) - Set up your own machine
29 | * [Getting an account on GitHub](./github.qmd) - Sign up for GitHub
30 | * [Securing your connection to GitHub](./SSH.qmd) - Create a secure SSH key to identify yourself on GitHub
31 | * [Creating an RStudio project](./rstudio_project.qmd) - Creating an example, version controlled project
32 | * [Starting our analysis project](./analysis_start.qmd) - A simple script to get us started
33 | * [Getting our project under version control](./version_control.qmd) - First step into a larger world
34 | * [Making some changes](./making_change.qmd) - Making our script more useful
35 | * [Committing our change](./commit.qmd) - How to commit a change
36 | * [Viewing history](./viewing_history.qmd) - How to view the history of your project or of a single file
37 | * [Connecting our local repository to GitHub](./github_sync.qmd) - Backup! Making our code available to the world.
38 | * [Subsequent updates](./updates.qmd) - Now we are set up, the workflow is easy.
39 | * [Things we haven't told you](./next_steps.qmd) - Steps to further learning
40 |
--------------------------------------------------------------------------------
/SSH.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Secure the connection between your computer and GitHub"
3 | format: html
4 | ---
5 |
6 | When working with a GitHub repository, you'll often need to identify yourself to GitHub using your username and password. There are several ways to secure this connection further. Establishing a secure connection is mandatory since August 2021.
7 |
8 | Today we will use **SSH Keys** to secure your identification to GitHub as this is a common way to secure connections, which you may encounter again in other contexts in the future.
9 |
10 | SSH keys come in pairs, a public key that gets shared with services like GitHub, and a private key that is stored only on your computer. If the keys match, you're granted access.
11 |
12 | The procedure below only need to be executed once per GitHub account and for each computer you will use to connect to GitHub.
13 |
14 | ## Checking for existing SSH key pair
15 | The first step in using SSH authorization with GitHub is to generate your own key pair.
16 | However, you might already have an SSH key pair on your machine. You can check to see if one exists by moving to your `.ssh` directory and listing the contents.
17 |
18 | On windows, open **Git Bash** (start menu -> Git Bash). On MacOS, open
19 | the **Terminal** app. On Linux, open your distribution's (or any
20 | other) terminal emulator. Enter the following commands one after the
21 | other (hitting ENTER after each command).
22 |
23 | ```bash
24 | ls ~/.ssh
25 | ```
26 |
27 | The `ls` command lists the content of a directory, here `~/.ssh`. Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following:
28 |
29 | ```bash
30 | id_rsa.pub
31 | id_ecdsa.pub
32 | id_ed25519.pub
33 | ```
34 |
35 | If you do have one, you can skip the section that generate a SSH key pair, and go to the section 'Adding a new SSH key to your GitHub account'.
36 |
37 | **If you don't have an existing public and private key pair (which is to be expected!), or if you receive an error that ~/.ssh doesn't exist, that this file location doesn't exist, or that you can't access this folder, go ahead and generate a new SSH key pair!**
38 |
39 | ## Generating an SSH key pair
40 |
41 | In the command line, type the following by replacing your_email@email.com with your own email address. Pay attention to spaces and capital letter!
42 |
43 | ```bash
44 | # MAKE SURE TO REPLACE "your_email@email.com" WITH YOUR EMAIL ADDRESS
45 | ssh-keygen -t ed25519 -C "your_email@email.com"
46 | ```
47 |
48 | This creates a new SSH key pair, using the provided email as a label.
49 |
50 | When you're prompted to "Enter a file in which to save the key," press ENTER. This accepts the default file location.
51 | This is the promt that will appear:
52 |
53 | ```bash
54 | Generating public/private ed25519 key pair.
55 | Enter file in which to save the key (/Users/username/.ssh/id_ed25519):
56 | ```
57 |
58 | You will then be asked to provide a passphrase. Protecting your keys with a password is optional but highly recommended. Note: when you type passwords in the command line, nothing is displayed, not even \***.
59 | This is the promt that will appear:
60 |
61 | ```bash
62 | Enter passphrase (empty for no passphrase):
63 | Enter same passphrase again:
64 | ```
65 |
66 | When the key generation is complete, you should see the following confirmation:
67 |
68 | ```bash
69 | Your identification has been saved in /Users/username/.ssh/id_ed25519.
70 | Your public key has been saved in /Users/username/.ssh/id_ed25519.pub.
71 | The key fingerprint is:
72 | SHA256:6nr/zo0g7Bz7WMRwy34maBhQy1UZyX47gT+egRdlIhs your_email@email.com
73 | The key's randomart image is:
74 | +--[ED25519 256]--+
75 | | .o++ |
76 | | o oF . o |
77 | | . o+ =.+. |
78 | | . + += . |
79 | | . +S++ |
80 | | . ..oB= |
81 | | . ++*=. |
82 | | o.==* o |
83 | | .o.o+** . |
84 | +----[SHA256]-----+
85 | ```
86 |
87 |
88 | ## Adding a new SSH key to your GitHub account
89 |
90 | We now need to tell GitHub about your public key. Display the contents of your new public key file with `cat`.
91 | **Be careful**: do not copy the content of your *private* key, but your *public* key. Your public key ends with `.pub`.
92 | Please type the command below exactly as it is, in its entirety:
93 |
94 | ```bash
95 | # Run this code
96 | cat ~/.ssh/id_ed25519.pub
97 | ```
98 |
99 | The output should look something like this:
100 |
101 | ```
102 | # The output looks like this. The characters after ssh-ed25519 will be different for you, however.
103 | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFEKiimOpcayfHhlbjmnIBAUX74FY/o20k9yFA16XOLm your_email@email.com
104 | ```
105 |
106 | Copy the contents of the output to your clipboard.
107 |
108 | Login to github.com and bring up your account settings by clicking on your profile photo (top right) and selecting **Settings**. Click on **SSH and GPG keys** (left sidebar), and then click on the green button 'New SSH key' or '**Add SSH key**'.
109 |
110 | 
111 |
112 | In the "Title" field, add a descriptive label for the new key, e.g. something that would identify the device you just connected. For example, if you're using a personal laptop, you might call this key "Personal MacBook Air". Finally, paste the contents of your clipboard into the Key text box and hit the green 'Add key' button to save. Enter your GitHub password if prompted.
113 |
114 | 
115 |
116 |
117 |
118 | ## Adding your key to the ssh-agent
119 |
120 | To manage your keys, it is best to use a piece of software called `ssh-agent`.
121 |
122 | Depending on your system, the following might not be necessary. On
123 | most GNU/Linux distributions, your key will be automatically added to
124 | the `ssh-agent` after the first time you enter it. If you keep getting
125 | asked for your key each time you want to clone or push to a GitHub
126 | repository, you can follow the following instructions.
127 |
128 | In the command line, start the ssh-agent with this command:
129 |
130 | ```bash
131 | eval "$(ssh-agent -s)"
132 | ```
133 |
134 | which should display an output similar to something like this:
135 |
136 | ```
137 | Agent pid 59566
138 | ```
139 |
140 | Then, add your key to the ssh-agent by typing the entirety of this command:
141 |
142 | ```bash
143 | ssh-add ~/.ssh/id_ed25519
144 | ```
145 |
146 | ## Testing Your Connection to GitHub
147 |
148 | (These instructions are a slightly abbreviated version of the page here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection)
149 |
150 | Finally, we can "ask" GitHub at the command line if our connection is acceptable with the following code:
151 |
152 | ```bash
153 | ssh -T git@github.com
154 | # Attempts to ssh to GitHub
155 | ```
156 |
157 | You will likely be asked about "fingerprinting" to which you can type `yes`, fingerprinting is okay, and press Enter. You should then receive a message like this:
158 |
159 | ```
160 | > Hi USERNAME! You've successfully authenticated, but GitHub does not
161 | > provide shell access.
162 | ```
163 |
164 | That's it!
165 |
166 | Going forward, you can use the SSH clone URL when copying a repo to your local machine (we will cover this in the second tutorial). You are completely done with the setting up part, which you will need to repeat only if you change computer.
167 | Let the fun begin!
168 |
169 | ***
170 |
171 |
--------------------------------------------------------------------------------
/_quarto.yml:
--------------------------------------------------------------------------------
1 | project:
2 | type: website
3 |
4 |
5 | website:
6 | title: ""
7 | page-footer:
8 | center: "Copyright, 2024 Open Science Center at LMU Munich"
9 | border: false
10 | search:
11 | location: sidebar
12 | repo-url: https://github.com/lmu-osc/Introduction-RStudio-Git-GitHub
13 | repo-actions: [edit, issue]
14 | page-navigation: true
15 | favicon: assets/LMU-OSC_favicon.jpg
16 | margin-header: |
17 | {width="175"}
18 | navbar:
19 | left:
20 | - href: index.qmd
21 |
22 |
23 | sidebar:
24 | style: docked
25 | contents:
26 | - text: "Home"
27 | href: index.qmd
28 | - section: "Tutorial"
29 | contents:
30 | - href: installing_software.qmd
31 | text: "Installing R and RStudio"
32 | - href: installing_git.qmd
33 | text: "Installing and configuring Git"
34 | - href: github.qmd
35 | text: "Getting an account on GitHub"
36 | - href: SSH.qmd
37 | text: "Securing your connection to GitHub"
38 | - href: rstudio_project.qmd
39 | text: "Creating an RStudio project"
40 | - href: analysis_start.qmd
41 | text: "Starting our analysis project"
42 | - href: version_control.qmd
43 | text: "Getting our project under version control"
44 | - href: making_change.qmd
45 | text: "Making some changes"
46 | - href: commit.qmd
47 | text: "Committing our change"
48 | - href: viewing_history.qmd
49 | text: "Viewing history"
50 | - href: github_sync.qmd
51 | text: "Connecting our local repository to GitHub"
52 | - href: updates.qmd
53 | text: "Subsequent updates"
54 | - href: next_steps.qmd
55 | text: "Things we haven’t told you"
56 |
57 |
58 | format:
59 | html:
60 | theme:
61 | - cosmo
62 | - custom.scss
63 | css: styles.css
64 | toc: true
65 | include-in-header:
66 | - file: matomo_analytics.html
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/analysis_start.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Starting our analysis project"
3 | format: html
4 | ---
5 |
6 |
7 | The purpose of this tutorial is to teach you version control. In order to do this, however, we'll need to make up a simple project that needs controlling!
8 |
9 | Our initial project will be extremely simple -- a very small data file and a script that loads and plots it. Later, we'll add code to fit a nonlinear curve to it.
10 |
11 | Download this data to your project folder: [Example data](https://raw.githubusercontent.com/RSE-Sheffield/Code_cafe/master/example_data.csv) (right click to open in a new window and use your Web browser's save as functionality (likely another right click on the page)). You may need to manually add the file extension ".csv").
12 |
13 | Create a new R script in RStudio. **File** -> **New File** -> **R script**
14 |
15 | Enter the following commands into your new R script
16 |
17 | ```r
18 | mydata = read.csv("example_data.csv")
19 | plot(mydata$xdata,mydata$ydata)
20 | ```
21 |
22 | Save the R script as `myscript.R`. When you run it, it should load and plot the data.
23 |
24 | Your directory should now contain 4 files:
25 |
26 | 
27 |
28 | ***
29 |
30 |
--------------------------------------------------------------------------------
/assets/GitHub-remote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/GitHub-remote.png
--------------------------------------------------------------------------------
/assets/LMU-OSC_favicon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/LMU-OSC_favicon.jpg
--------------------------------------------------------------------------------
/assets/LMU-OSC_logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/LMU-OSC_logo.jpg
--------------------------------------------------------------------------------
/assets/add-ssh-key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/add-ssh-key.png
--------------------------------------------------------------------------------
/assets/commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/commit.png
--------------------------------------------------------------------------------
/assets/file_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/file_list.png
--------------------------------------------------------------------------------
/assets/first_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/first_commit.png
--------------------------------------------------------------------------------
/assets/first_push_confirm_identity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/first_push_confirm_identity.png
--------------------------------------------------------------------------------
/assets/git_changed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_changed.png
--------------------------------------------------------------------------------
/assets/git_commit_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_commit_message.png
--------------------------------------------------------------------------------
/assets/git_commit_message2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_commit_message2.png
--------------------------------------------------------------------------------
/assets/git_commit_message3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_commit_message3.png
--------------------------------------------------------------------------------
/assets/git_diff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_diff.png
--------------------------------------------------------------------------------
/assets/git_history_tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_history_tab.png
--------------------------------------------------------------------------------
/assets/git_history_tab_filter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_history_tab_filter.png
--------------------------------------------------------------------------------
/assets/git_history_tab_filter_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_history_tab_filter_example.png
--------------------------------------------------------------------------------
/assets/git_more_shell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_more_shell.png
--------------------------------------------------------------------------------
/assets/git_pane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_pane.png
--------------------------------------------------------------------------------
/assets/git_pane_added.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_pane_added.png
--------------------------------------------------------------------------------
/assets/git_push.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/git_push.png
--------------------------------------------------------------------------------
/assets/github_git_commands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/github_git_commands.png
--------------------------------------------------------------------------------
/assets/my_new_repo_name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/my_new_repo_name.png
--------------------------------------------------------------------------------
/assets/new_repo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/new_repo.png
--------------------------------------------------------------------------------
/assets/new_repo_name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/new_repo_name.png
--------------------------------------------------------------------------------
/assets/project_files.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/project_files.png
--------------------------------------------------------------------------------
/assets/project_screen1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/project_screen1.png
--------------------------------------------------------------------------------
/assets/project_screen2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/project_screen2.png
--------------------------------------------------------------------------------
/assets/project_screen3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/project_screen3.png
--------------------------------------------------------------------------------
/assets/readme_commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/readme_commit.png
--------------------------------------------------------------------------------
/assets/ssh-key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/ssh-key.png
--------------------------------------------------------------------------------
/assets/staged_readme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lmu-osc/Introduction-RStudio-Git-GitHub/daade7c25ff2a369bb325fabf657ca8773f8edda/assets/staged_readme.png
--------------------------------------------------------------------------------
/commit.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Committing our change"
3 | format: html
4 | ---
5 |
6 |
7 | **All files need to be saved before being 'committable'**.
8 |
9 | Now, click on the **git** tab in RStudio. You'll notice that there are two files listed -- our script, which has been modified, and our script too, which was added. Click on the staged box to stage the change to the first script.
10 |
11 | 
12 |
13 | Now click on **Diff** to give a summary of what's changed. Lines that have been added are green. Lines that have been removed are red. From git's point of view, a modification to a line is actually two operations: the removal of the original line followed by the creation of the new line.
14 |
15 | 
16 |
17 | Add a commit message and click on commit
18 |
19 | 
20 |
21 | Now stage the second script, and commit it with a new message.
22 |
23 | 
24 |
25 |
26 | ***
27 |
28 |
--------------------------------------------------------------------------------
/custom.scss:
--------------------------------------------------------------------------------
1 | /*-- scss:defaults --*/
2 | // Base document colors
3 | $navbar-bg: #009933;
4 | $link-color: #006426;
5 | $sidebar-hl: #006426;
6 |
--------------------------------------------------------------------------------
/github.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Create an account on GitHub"
3 | format: html
4 | ---
5 |
6 |
7 | Although git can be used on its own, most people choose to use it in conjunction with an online repository service. The most popular of these, by far, is GitHub.
8 |
9 | It has become so standard that some organisations will ask to see your GitHub profile as part of job applications!
10 |
11 | * Create a free account on GitHub.
12 | * https://github.com/join
13 |
14 | You do not need to select any additional products proposed upon creation of the account.
15 |
16 | ***
17 |
18 |
--------------------------------------------------------------------------------
/github_sync.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: " Connecting our local repository to GitHub"
3 | format: html
4 | ---
5 |
6 | Our project is fully version controlled so we have access to a detailed history of every change we've ever made to it. This is a great first step but all of this only exists on our own computers at the moment.
7 |
8 | It's time to upload our project to GitHub!
9 |
10 | Putting your code on GitHub confers a number of benefits:
11 |
12 | * Everything is backed up for you.
13 | * Your project is made available to others. This is a vital part of modern scientific dissemination.
14 | * GitHub has a range of project management and collaboration tools that work on a per-project basis.
15 | * Your GitHub profile can be used as part of your online-identity.
16 |
17 | **Creating a new repository on GitHub**
18 |
19 | * Log into GitHub and go to your profile page. On the **repositories** tab, click **New**
20 |
21 |
22 |
23 | At the **Create a new repository** screen, give your repo a name and click **Create Repository**.
24 | In this case only, when you didn't start by creating a repo on GitHub but want to push from an exisiting local repository for the first time like we are doing now and like you would to upgrade your old projects, do NOT select 'create a README file' but directly 'Create repository'.
25 |
26 | 
27 |
28 | The **Quick Setup** screen gives sets of git commands that can be used in various circumstances.
29 | First, make sure you select the SSH tab (the url shown in the blue box should start with git@github.com).
30 |
31 |
32 |
33 | We are then interested in **…or push an existing repository from the command line**. Copy these commands to the clipboard using the copy button on GitHub.
34 |
35 | 
36 |
37 | In RStudio, navigate to the **git** tab and click on **More -> New terminal**
38 |
39 | 
40 |
41 |
42 |
43 | Paste the git commands into the Shell and press Enter to execute them.
44 | Given this is your first push, you may be asked again to authenticate your identity by entering the password of your SSH key
45 |
46 | 
47 |
48 |
49 | and/or prompted with such sentence in the terminal:
50 |
51 | ```bash
52 | Are you sure you want to continue connecting (yes/no/[fingerprint])?
53 | ```
54 | to which you should answer `yes`
55 |
56 |
57 |
58 | > **Warning for Windows OS with RStudio > 2022.12.0**
59 | > If you get an error saying you do not have a SSH key in the appropriate location, this is due to a known bug in the RStudio / Git bash interaction which we expect to be eventually resolved with updates. A temporary solution is to open the Windows Power Shell instead of Git Bash as terminal within RStudio: for this, go to RStudio -> Tools -> Global Options -> Terminal -> New terminals open with -> choose Windows Power Shell -> Click Apply -> close the panel -> Complete the steps above (i.e. paste or type the commands presented by your new GitHub repo) -> change back the default terminal within RStudio to Git Bash.
60 |
61 |
62 |
63 | Finally, confirm that the project has been uploaded to your GitHub profile (you may need to refresh your GitHub page).
64 |
65 | ***
66 |
67 |
--------------------------------------------------------------------------------
/index.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Introduction to version Control with git and GitHub within RStudio"
3 | format: html
4 | ---
5 |
6 | ## About this work
7 |
8 | This work was originally created by [Mike Croucher](https://github.com/mikecroucher) from [RSE-Sheffield](https://github.com/RSE-Sheffield) under a [Creative Commons Attribution Share Alike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/legalcode). It was subsequently adapted by [Malika Ihle](https://www.osc.uni-muenchen.de/about_us/coordinator/index.html) during her time at [Reproducible Research Oxford](https://ox.ukrn.org/) and alter the the [LMU Open Science Center](https://www.osc.uni-muenchen.de/index.html). The overview image is from [Dumitru Uzun](https://duzun.me/tips/git). You are free to use this work in your own projects.
9 |
10 | ## Before the session
11 | Please watch this 10 min introductory [videorecording](https://osf.io/dcqt9/).
12 |
13 | ## Overview of the exercice
14 | In this session, you are going to start using the version control system Git from within RStudio to keep your local workflow tidy while having access to all previous versions of your files. You will then backup your workflow online on a remote GitHub server, which will allow you to access your work from any computer, and sharing it with your collaborators or publically. Specifically, you will
15 |
16 | * install and configure Git (as well as R and RStudio if needed), and create a GitHub account
17 | * create a local RStudio project under version control
18 | * make changes and **commit** them to your local repository (i.e. save your changes locally in your version control system)
19 | * connect your local repository to your GitHub account by creating a remote GitHub repository and setting it as the 'origin' of your local repository from the command line. This is the procedure you will have to follow to 'upgrade' your former RStudio projects that were not under version control and backed-up on GitHub; but in the future, I recommend you first create a GitHub repository (your remote origin) and then **clone** it locally (i.e. copy it to your computer while maintaining a connection to your remote (GitHub) version). This procedure, easily done from RStudio, will be covered in the [second workshop](https://lmu-osc.github.io/Collaborative-RStudio-GitHub/)
20 | * **push** your local changes to your remote repository (i.e. synchronise your changes to your GitHub version)
21 |
22 | Once this workflow is set up, you can easily work with several computers or with collaborators: if you have changes in your GitHub version (if you or a collaborator pushed changes from another computer or if you made changes online, directly on GitHub), you can **pull** them into your local version (i.e fetch changes and merge them locally, to keep your copy up-to-date).
23 |
24 |
25 |
26 |
27 |
28 | ## Step-by-step tutorial
29 | The material is self-paced and includes a worked-example. It is necessary that you work through the sections in order.
30 |
31 | * [Installing R and RStudio](./installing_software.qmd)
32 | * [Installing and configuring Git](./installing_git.qmd) - Set up your own machine
33 | * [Getting an account on GitHub](./github.qmd) - Sign up for GitHub
34 | * [Securing your connection to GitHub](./SSH.qmd) - Create a secure SSH key to identify yourself on GitHub
35 | * [Creating an RStudio project](./rstudio_project.qmd) - Creating an example, version controlled project
36 | * [Starting our analysis project](./analysis_start.qmd) - A simple script to get us started
37 | * [Getting our project under version control](./version_control.qmd) - First step into a larger world
38 | * [Making some changes](./making_change.qmd) - Making our script more useful
39 | * [Committing our change](./commit.qmd) - How to commit a change
40 | * [Viewing history](./viewing_history.qmd) - How to view the history of your project or of a single file
41 | * [Connecting our local repository to GitHub](./github_sync.qmd) - Backup! Making our code available to the world.
42 | * [Subsequent updates](./updates.qmd) - Now we are set up, the workflow is easy.
43 | * [Things we haven't told you](./next_steps.qmd) - Steps to further learning
44 |
--------------------------------------------------------------------------------
/installing_git.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Installing and configuring Git"
3 | format: html
4 | ---
5 |
6 | RStudio version control functionality is provided by another software called **git**
7 |
8 |
9 | **Install git**
10 |
11 | Git is one of the most popular version control systems in the world. It is free and open source.
12 |
13 | * Windows & OS X: http://git-scm.com/downloads
14 | * Windows: download the .exe file, run it and accept all the default settings (unless you know what you are doing) and keep clicking 'next'
15 | * OS X: at the link above, select the first option that suggests to install git through installing homebrew, by pasting a line of command provided in their instructions in your terminal, and accept the prompts appearing in your terminal.
16 | * Debian/Ubuntu: `sudo apt-get install git-core`
17 | * Fedora/RedHat: `sudo yum install git-core`
18 |
19 | **Configure git**
20 |
21 | After installing git, you need to tell it who you are.
22 |
23 | By default, git is used through a _command line interface_. We'll use
24 | git in this way now in order to perform its initial and minimal
25 | configuration. In the remaining of this tutorial, you'll learn how to
26 | use git through Rstudio instead of a command line interface.
27 |
28 | On windows, open **Git Bash** (start menu -> Git Bash). On MacOS, open
29 | the **Terminal** app. On Linux, open your distribution's (or any
30 | other) terminal emulator. Enter the following commands EXACTLY (spaces and quotation marks included) one after the
31 | other (hitting ENTER after each command). On successful completion, you should see no output from these commands.
32 |
33 | Make sure to replace `you@youremail.com` and `Your Name` by your email
34 | address and your name.
35 |
36 | ```bash
37 | git config --global user.email "you@youremail.com"
38 | git config --global user.name "Your Name"
39 | ```
40 |
41 |
42 | ***
43 |
44 |
--------------------------------------------------------------------------------
/installing_software.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Installing R and RStudio"
3 | format: html
4 | ---
5 |
6 |
7 | Many users of R use it from within another free piece of software called **RStudio.**
8 | RStudio is a powerful and productive user interface for R. It’s free and open source, and works great on Windows, Mac, and Linux.
9 |
10 | **Install R**
11 |
12 | Install R first. Downloads are available at https://cran.rstudio.com/
13 |
14 | * Direct link for Windows https://cran.r-project.org/bin/windows/base/
15 | * Direct link for MacOS X https://cran.r-project.org/bin/macosx/
16 | * Direct link for Linux https://cran.r-project.org/bin/linux/
17 |
18 | **Install RStudio**
19 |
20 | Next, install RStudio.
21 |
22 | * Downloads are available at https://www.rstudio.com/products/rstudio/download/
23 |
24 |
25 |
26 | ***
27 |
28 |
--------------------------------------------------------------------------------
/making_change.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Making some changes"
3 | format: html
4 | ---
5 |
6 | The next version of our project will do 3 changes.
7 |
8 | 1. Add the following code to the end of your R script.
9 |
10 | ```r
11 | # some guesses for the parameters.
12 | p1 = 1
13 | p2 = 0.2
14 |
15 | # do the fit
16 | fit = nls(ydata ~ p1*cos(p2*xdata) + p2*sin(p1*xdata), data = mydata, start = list(p1=p1,p2=p2))
17 |
18 | #Plot the fitted line
19 | new = data.frame(xdata = seq(min(mydata$xdata),max(mydata$xdata),len=200))
20 | lines(new$xdata,predict(fit,newdata=new))
21 |
22 | ```
23 |
24 | 2. change the command that plots our data in this file. Change the lines
25 |
26 | ```r
27 | plot(mydata$xdata,mydata$ydata)
28 | ```
29 |
30 | to
31 |
32 | ```r
33 | plot(mydata$xdata,mydata$ydata,col='red')
34 | ```
35 |
36 | We do this so we can illustrate how git handles modifications of existing lines as well as simply adding extra lines of code.
37 |
38 | Make sure the code runs before proceeding further and save the script.
39 |
40 | 3. Finally, we will **create another R file** (File -> New File -> R script).
41 |
42 | Enter the command:
43 |
44 | ```r
45 | #Simulate some data
46 | plot(rnorm(100,0,1))
47 | ```
48 | And save the file as `myscript_too`
49 |
50 |
51 | ***
52 |
53 |
--------------------------------------------------------------------------------
/matomo_analytics.html:
--------------------------------------------------------------------------------
1 |
2 |
15 |
--------------------------------------------------------------------------------
/next_steps.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Things we haven't told you"
3 | format: html
4 | ---
5 |
6 |
7 | You've come a long way! You've installed and configured all the software you need and have learned the basics required to put your code under version control and make it openly available to the world.
8 |
9 | As you've seen, the standard git workflow is fairly straightforward and adds very little overhead to your workflow once you're set up.
10 |
11 | Git and GitHub are extremely powerful systems and there is a lot more you can learn if you wish. Here are some pointers:-
12 |
13 | * Learn command line git by following this tutorial from Software Carpentry - http://swcarpentry.github.io/git-novice/
14 | * Make your analysis citable and more discoverable by using Zenodo to assign it a Digital Object Identifier - https://zenodo.org/features
15 |
16 | **Testing and version control**
17 |
18 | By employing testing, you can ensure that your code behaves the way you expect.
19 |
20 | * Unit testing in R, the bare minimum - http://www.johnmyleswhite.com/notebook/2010/08/17/unit-testing-in-r-the-bare-minimum/
21 | * Continuous Integration. Every time you push a change to GitHub, your tests are automatically run. - https://docs.travis-ci.com/user/languages/r
22 |
23 | **Dealing with dependencies**
24 |
25 | Your code works on your machine but not on someone else's because they are using a different version of R and have different versions of packages installed. How might we fix this?
26 |
27 | * https://lmu-osc.github.io/introduction-to-renv/ - renv enhances your project directory by storing your package dependencies inside it.
28 |
29 | ***
30 | ::: {style="text-align: right"}
31 | [Go to the second tutorial!](https://lmu-osc.github.io/Collaborative-RStudio-GitHub/){.btn .btn-success .btn role="button"}
32 | :::
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/rstudio_project.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Creating an RStudio project"
3 | format: html
4 | ---
5 |
6 |
7 | A project is a folder that contains everything concerning your analysis and may include code, data and documentation. It is a complete research object that can be used to describe and reproduce your research.
8 |
9 | Create a new project in RStudio as follows:
10 |
11 | **File** -> **New Project** -> **New Directory**
12 |
13 |
14 |
15 | In the **Project Type** screen, click on **Empty Project** or **New project**
16 |
17 |
18 |
19 | In the **Create New Project** screen, give your project a name (e.g.'my_first_test_repo') and ensure that **create a git repository** is checked. Click on **Create Project**.
20 |
21 |
22 |
23 | RStudio will create a new folder containing an empty project and set R's working directory to within it.
24 |
25 |
26 | Two files are created in the otherwise empty project:
27 |
28 | 
29 |
30 | * **.gitignore** - Specifies files that should be ignored by the version control system (e.g. sensible data files that should not be made public, or documentation that you don't need version controlled).
31 | * **my_first_test_repo.Rproj** - Configuration information for the RStudio project
32 |
33 | There is no need to worry about the contents of either of these for the purposes of this tutorial.
34 |
35 | ***
36 |
37 |
--------------------------------------------------------------------------------
/styles.css:
--------------------------------------------------------------------------------
1 | /* css styles */
2 |
3 | .nav-page .nav-page-text {
4 | font-size: 15pt;
5 | }
6 |
--------------------------------------------------------------------------------
/updates.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Subsequent updates"
3 | format: html
4 | ---
5 |
6 |
7 | Once a local repository has been associated with GitHub, it's not necessary to use the command line for subsequent uploads. We'll demonstrate this now by adding a **README.md** file to our project.
8 |
9 | On GitHub, the README.md file is special since it is rendered by GitHub and is used by many people as an introduction to the project.
10 |
11 | In RStudio, click on **File->New File->Text File**. Add the following text to the file and save it as **Readme.md**.
12 |
13 | ```bash
14 | # My Example Repo
15 |
16 | This repo is used to demonstrate GitHub to users of R and R Studio.
17 | ```
18 |
19 | In the **git** tab of RStudio, the **Readme.md** file should be the only file you see. Stage it as shown below and click **commit**.
20 |
21 | 
22 |
23 | Supply a commit message and click commit.
24 |
25 | 
26 |
27 | Finally, click **push** to upload to GitHub.
28 |
29 | 
30 |
31 | You can see that the standard workflow loop is very quick and simple
32 |
33 | * Make your change
34 | * Stage your change
35 | * Commit
36 | * Push to GitHub
37 |
38 | ***
39 |
40 |
--------------------------------------------------------------------------------
/version_control.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Getting our project under version control"
3 | format: html
4 | ---
5 |
6 |
7 | We now have the first version of our analysis so let's get it under version control. By default, the git version control pane is in the top right hand corner of RStudio. Find it and click on the **git** tab.
8 |
9 | 
10 |
11 | If you hover the mouse pointer over the yellow ? marks in GitHub, you'll see a tooltip telling us that the file is **untracked**. This means that git is not tracking versions of this file.
12 |
13 | Tick **staged** for each file. In some future cases, you may want to stage only one or a few file to create a coherent commit (unit of change).
14 |
15 | 
16 |
17 | All of our files are now **staged**, ready for the first **commit**. Click on the **commit** button
18 |
19 | 
20 |
21 | Details of the commit will appear in the next panel. You need to specify a **commit message** -- something descriptive about the changes you've made. Since this is our first commit, we'll follow tradition and call it **First Commit**
22 |
23 | Once you've typed a commit message, click on **Commit** and you're done.
24 |
25 | 
26 |
27 | The following messages from git will show.
28 |
29 |
30 |
31 | Click on **Close** and you are done.
32 |
33 | ***
34 |
35 |
--------------------------------------------------------------------------------
/viewing_history.qmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Viewing history"
3 | format: html
4 | ---
5 |
6 |
7 | In this **Diff** pop up window, which you found in the **git** tab of RStudio, you can also press the **History** button to review the history of your project or files.
8 |
9 |
10 | 
11 |
12 |
13 | By default, the history search feature will show all files added, changed, or deleted for each commit. This can be extremely useful for finding bugs or looking back to how your project looked a few months ago. However, it is often more practical to review the changes made to a single file over time; this enables, for example, clear tracking of the evolution of data cleaning and analysis steps in your project.
14 |
15 |
16 | To the right of the **History** button, there should now be a drop-down box titled `(all commits)`. Press this box to see the other options, which should be titled "Filter by File" and "Filter by Directory." Select the **"Filter by File"** option.
17 |
18 |
19 | 
20 |
21 |
22 | A file-section window should appear on your screen; select the file you would like to review, e.g. `myscript.R`.
23 |
24 | You will then get only the specific commits in which the selected file was included (i.e. when it was added, deleted, or edited). Click on any of the commit messages to view that specific commit, and scroll further down the screen to view changes made to the file during that commit.
25 |
26 |
27 | 
28 |
29 |
30 | It's not possible to revert back to a previous commit using the RStudio interface. For that, you need to learn some command-line git which is beyond the scope of this session.
31 |
32 |
33 | ***
34 |
35 |
--------------------------------------------------------------------------------