![syncing a fork github desktop syncing a fork github desktop](https://i.stack.imgur.com/MnXsk.png)
#> ✔ Setting remote tracking branch for local 'main' branch to 'upstream/main' #> ✔ Setting active project to ''įor an RStudio user, create_from_github(fork = TRUE) does all of this: Usethis :: create_from_github ( "" ) #> ℹ Defaulting to 'https' Git protocol #> ✔ Setting `fork = TRUE` #> ✔ Creating '/some/path/to/local/REPO/' #> ✔ Forking 'OWNER/REPO' #> ✔ Cloning repo from '' into '/some/path/to/local/REPO' #> ✔ Setting active project to '/some/path/to/local/REPO' #> ℹ Default branch is 'main' #> ✔ Adding 'upstream' remote: '' #> ✔ Pulling changes from 'upstream/main'. Here is what that might look like (note that we’re accepting the default behaviour for many arguments): You often don’t need to specify fork and can just enjoy the default behaviour, which is governed by your permissions on the source repo.īy default, fork = FALSE if you can push to the source repo and fork = TRUE if you cannot. The fork argument specifies whether to clone ( fork = FALSE) or fork and clone ( fork = TRUE).
![syncing a fork github desktop syncing a fork github desktop](https://blog.nillsf.com/wp-content/uploads/2020/05/image-31.png)
If you like to keep Git repos in a certain folder on your computer, you can personalize this default by setting the stdir option in your. If you don’t specify destdir, usethis defaults to some very conspicuous place, like your desktop. The destdir argument specifies the parent directory where you want the new folder (and local Git repo) to live. In particular, you can use the URL we just copied for the source repo. The first argument is repo_spec and it accepts the GitHub repo specification in various forms. Look in RStudio’s file browser pane for the README.md file.Usethis :: create_from_github ( "", destdir = "~/path/to/where/you/want/the/local/repo/", fork = TRUE ) This should download the README.md file from GitHub. You should find yourself in a new local RStudio Project that represents your test repo on GitHub. I suggest you check “Open in new session”, as that’s what you’ll usually do in real life.A common rookie mistake is to have no idea where you are saving files or what your working directory is. Take charge of – or at least notice! – where the Project will be saved locally.myrepo, which coincides with the GitHub repo name. Accept the default project directory name, e.g.Still no luck? Go to chapter 13 for tips on how to help RStudio find Git. Do you NOT see an option to get the Project from Version Control? Restart RStudio and try again.In “Repository URL”, paste the URL of your new GitHub repository. File > New Project > Version Control > Git.ġ2.3 Clone the test GitHub repository to your computer via RStudio Here’s how to do that in the shell, if current working directory is myrepo: cd. It’s just a regular directory on your computer. It’s a deeply pragmatic coping strategy if your local Git repo is goofed up, but the version on GitHub is pretty current.ĭelete the folder corresponding to the local repo any way you like. This is a actually a workflow we refer to elsewhere (see 37 as “burn it all down”. However, I encourage you to delete the local repository, so you can experience how we use RStudio to clone it and get a local copy. If you just completed the previous chapter, Connect to GitHub, that repo will be perfect! If you don’t have a suitable test repository on GitHub, follow the instructions in the next section.
![syncing a fork github desktop syncing a fork github desktop](https://simonscholz.github.io/tutorials/github-fork-sync/fork-dialog-github.png)
You will also need a test repository on GitHub. You’ve confirmed that you can push to / pull from GitHub from the command line (chapter 11).You’ve introduced yourself to Git (chapter 7).You’ve installed/updated R and RStudio (chapter 5).You’ve registered a free GitHub account (chapter 4).