class: center, middle, title-slide # Connecting to Your UI GitLab Repository ### Luke Tierney ### University of Iowa ### 2022-01-21 --- ## Prereqisites Make sure that: -- * You have git installed on your computer. -- * You have [introduced yourself to git](https://happygitwithr.com/hello-git.html) using `git config` in a shell. -- * You have registered with <https://research-git.uiowa.edu>. -- Look at the [brief introduction to git](../git.html) or the beginning of <https://happygitwithr.com> if you still need to do any of this. -- The first chapter of <https://happygitwithr.com> and the [brief introduction to git](../git.html) provide some background on git. --- layout: true ## Option 1: Use Rstudio --- In RStudio open a new project from the **File** menu, choose the **Version Control** option, and Git as the version control system. -- * Your repository URL will be `https://research-git.uiowa.edu/stat4580-spring-2022/<hawkid>.git` with `<hawkid>` replaced with your HawkID. -- * You can accept the defaults for the directory name and location or chose something else. -- * Don't choose a directory name with spaces in it. -- Open the `README.md` file for your project in RStudio, add something to it, and save the changes. -- From the **Tools** menu choose **Version Control** and then **Commit**. -- Check the box next to `README.md`, write a commit message, and press the **Commit** button. -- Close the version control window. Your changes have been committed to your local repository. -- You can also use the **Git** panel for the preceding steps. --- To _push_ your changes to GitLab, from the **Tools** menu choose **Version Control** and then **Push Branch**. You may have to provide your HawkID and password at this point. -- You should now be able to see your changes in your remote repository in the [class group](https://research-git.uiowa.edu/STAT4580-Spring-2022/). -- A [video](https://youtu.be/WEFgikIjG4A) is available that walks through this process. -- The video also shows some basic use of markdown syntax. --- layout: true ## Option 2: Using the Shell --- Open a shell. -- Go to the parent directory where you want your local repository to live. -- In the shell, give the command ```shell git clone https://research-git.uiowa.edu/stat4580-spring-2022/<hawkid>.git <dirname> ``` with `<hawkid>` replaced by your Hawk ID and `<dirname>` by the directory name you want. -- You can omit the directory name `<dirname>` if you are happy with the default, the name of your repository. **If you choose your own directory name, do not choose one with spaces in it**. -- Change your working directory to your local repository (`cd <dirname>` on Linux). -- Edit `README.md` and save. -- Commit your changes with the command ``` shell git commit -m "My commit message." README.md ``` --- Push your changes with the command ``` shell git push ``` -- If you want to manage this repository from RStudio you can turn it into an RStudio project by creating a new project and choosing the _Existing Directory_ option. --- layout: false ## Creating and Submitting Your First Assignment Create a new folder `HW1` in your project; you can do this -- * in RStudio with the **Files** panel; -- * using your computer's file browser; -- * in a `bash` shell using `mkdir`; -- * in the R console using `dir.create`. -- Create a new R Markdown document `hw1.Rmd` -- * in RStudio using **File** > **New File** > **R Markdown**; -- if the `STAT4580` package is installed you can chose the **STAT4580 Homework** _template_; -- * in the R console using `download.file` to download the template <https://homepage.divms.uiowa.edu/~luke/classes/STAT4580-2022/hwtemp.Rmd> -- Edit, preview, stage, and commit locally. -- Push to GitLab. --- ## Some Notes It is a good idea to commit often. -- If you work on several computers, or with a collaborator, be sure to _pull_ changes from the repository before starting to work on new changes. -- You do not have to push after every commit, but it's a good idea to do so. -- A [video](https://youtu.be/NHcTay-ZujQ) is available that walks through starting on the first assignment. --- ## Exercises 1. Take possession of your GitLab repository. 2. Edit your `README.md` file, commit, and push your changes. 3. Check that you can see your changes on the UI GitLab site. Find the SHA hash for your commit. 4. Get set up to work on the first assignment.