Rendered product: https://happygitwithr.com
jennybc / happy-git-with-r Goto Github PK
View Code? Open in Web Editor NEWUsing Git and GitHub with R, Rstudio, and R Markdown
Home Page: https://happygitwithr.com
License: Other
Using Git and GitHub with R, Rstudio, and R Markdown
Home Page: https://happygitwithr.com
License: Other
Rendered product: https://happygitwithr.com
You give two sets of instructions for syncing a fork. To work purely on Github, you link to the page
http://www.hpique.com/2013/09/updating-a-fork-directly-from-github/
That's a bit out of date (some button labels have changed), but more importantly, it doesn't work. I had the same problem as several of the commenters: it creates a pull request to do the update; after I accept that pull request on my fork, I'm out of sync with the upstream, and can't do it again.
I haven't tried the command line instructions yet, but they make more sense. I just wish there were a way to do them online.
Currently, I link out to STAT 545.
Here I refer to "homework 1", mostly for basic knowledge/practice with markdown. It should be easy to swap that out with something external.
http://stat545.com/block007_first-use-rmarkdown.html#step-0-software-installation-and-configuration
There have been many changes about private repos recently. Do people still need to bother getting education accounts? Or maybe it's more important then ever?
2016 outline (most of these requests have additional info in the body btw):
GET /users/:username
POST /orgs/STAT545-UBC/teams
PUT /teams/:id/memberships/:username
POST /orgs/STAT545-UBC/repos
PUT /repos/STAT545-UBC/:repo/collaborators/:username
PUT /teams/:id/repos/STAT545-UBC/:repo
DELETE /repos/:owner/:repo/subscription
First year I have not created singleton teams and granted repo access solely through singleton team membership. In 2014 that was necessary due to restrictions in team/org permissions. By 2015 that had changed, but the change was very new and I didn't change my behaviour. 2016 is the first year I've taken advantage of fact you can add individuals as collabs to private Org-owned repos.
And here's a peculiar consequence.
Students can start pushing their repos right away. Specifically, can do so w/o accepting the invitation to join the Org. You discover this when you try to assign them peer review. POST /repos/:owner/:repo/issues
gives 422 whenever the putative reviewer (who will be specified as assignee in the body of the request) is not a member of the 2016_students team, which is what confers the necessary read access.
Jenny, we talked briefly about how you have students use github to share their homework with you. I'm hoping you could share your workflow on that. Thanks, Great workshop!
--Richard
One general goal is to make it very unlikely that a novice finds self unexpectedly "in the middle of" a merge. Obviously there's no way to universally avoid reconciling conflicts, but it's much nicer to be alerted to the problem and given the chance to decide how to proceed.
Default to allowing only fast forward merges upon pull.
git config --add pull.ff only
It's possible that doing same for merges (merge.ff) is a good idea too?
Re: doing something sensible when you just do git push
, with no branch specified.
Push the current branch to a branch of the same name. And that's it. Don't push other branches.
git config --global push.default current
More notes ...
Git 2.0 (release 2014-05) uses simple
push strategy by default:
git push origin remotebranchename
Git versions below 2.0 use matching
strategy by default:
git push
, no arguments, pushes ALL branches that have same name locally and on remoteConclusion: simple
is better than matching
.
Re: current
vs simple
, apparently this has to do with upstream tracking branches and branch names, which is yet another issue. If you always name local branch and remote branch the same, you will never notice the difference. I guess technically simple
is safer.
Poll of CSAMA students during the Git/GitHub/RStudio lab:
What is your OS?
Add an emoji to the relevant comment below.
If you turn on 2FA and want to push to github via https, you will need to send a PAT as password.
http://olivierlacan.com/posts/why-is-git-https-not-working-on-github/
To make it parallel with credential caching, there should really be some sort of test that push/pull works.
I just spent two hours trying to figure out why I could push from my laptop and not from my desktop. Turns out I was a bit glib cloning the project on the desktop and ended up with the HTTPS repository url on the desktop. I was able to pull and pass the tests for whether github would take my SSL. So took me quite a while to solve my problem. My suggestion is to add a bit of warning to section 13.7:
If you think SSH is working and you are still challenged for your credentials, check your project options and make sure that the the project origin starts with [email protected] (not with HTTPS:).
[It turns out I still don't know how to change the project origin once I screwed it up. I had to burn it down on my desktop RStudio and clone it again. If I had followed the instructions more carefully, I wouldn't have had this problems, but who follow directions?]
Issue opened for use during Happy Git and GitHub for the useR workshop at satRday Cape Town.
Use an emoji reaction to indicate which operating system you use.
Issue opened for use during Happy Git and Gihub for the useR tutorial at rstudio::conf 2017.
Use an emoji reaction to indicate which operating system you use.
Please find attached detailed account of attempts to link up RStudio and Git.
I have followed the instructions in your excellent, clearly written guide to using git and R.
However, I am struggling to get RStudio to recognise Git. I am at a loss to know what to do as I had a previous version of Git that was working on my computer and for some inexplicable reason Git and RStudio no longer work together. I am afraid I cannot recall what I may have done to cause the disassociation between RStudio and Git.
I have completely uninstalled R, RStudio and Git and re-installed all applications but still have the issue that RStudio does not recognise Git.
In summary:
Git is installed on my computer (OS - Windows 7 64 bit)
RStudio has identified the git.exe file and path in Tools | Global options | Git/SVN
But when I try to set up a New Project or try to checkout a project from a version control repository – I get the “Git was not detected on the system path” error message.
Echo $PATH in the Git Bash shell did not include “Git”
Editing the PATH variables in windows has not resolved the issue.
Screen shots of the attempts to resolve this are included in the attached file.
Happy to help in any other way to try to resolve this.
Older versions of git may throw warning regarding push behavior:
$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
"...it only affects what happens when you don't specify which branches you want to push."
Relevant git docs (see push.default
)
Git version of student who experienced error: git version 1.9.5 (Apple Git-50.3)
, on Mac OS X 10.9.5
Relevant to section 10.3 of instructions.
Issue was resolved by installing XCode, as per 7.3 Option 1
git config --global push.default simple
http://ellisp.github.io/blog/2016/09/16/version-control
nice link tweeted by @nicholasjhorton
In today's practice run at UBC, we had two troublesome computers. Both Macs (!!!). OS versions were 10.10.5 Yosemite (@MarinStatsLectures) and 10.9.5 Mavericks (Natalia). FWIW current is 10.11 El Capitan.
Problem: RStudio never could use Git. The Git pane did not appear.
What I know (I hope @ttimbers will confirm):
which git
revealed a git executable for bothecho $PATH
revealed that the location of the git executable was indeed on the pathBut we don't get the Git tab in upper right pane. Can't check "create git repo" for new projects. Etc etc.
Email UBC dry run participants once we deploy a stand-alone site to a stable URL
@daattali I want to deploy this site, skeletal though it may be, before tomorrow's dry run. That's my late afternoon / late night work plan for today. It's all meetings for me until then 😟. If you have a chance to offer an informed opinion on where/how to deploy this, I'd love to hear it. You can read about bookdown deployment options in this chapter:
Add the config info mentioned here:
@Anmol6 Please don't do this yet.
I have a lot of content to migrate over after today's practice run. I will stub something out for you. But you can expect this request from me very soon: bring the SSH key setup instructions over from MDS set up repo.
Hi people who are somehow involved in this (or who I hope might be in the fullness of time).
Just an alert that I will be assembling the materials here. Immediate motivation is useR, though I am trying to plan for the long haul.
Hi,
I really appreciate "Happy git with R."
How amazing would it be if there was a 2nd installment in the series called "Happy Docker with R"?
I, for one, would love that.
Please consider it.
Kind regards,
Tomasz
Could you add a CONTRIBUTING.md document with guidelines on how to contribute to this project? It's an exciting endeavor!
This issue looks to be related to #67
I just installed git using the exact same settings as OP and I get the same issue:
I tried OPs suggestion and reinstalled (checking use git from windows command prompt option) but it still does not work.
I'm not able to get Git CMD Working either (Although maybe I dont understand the difference between GitCMD and Git Bash):
On the Render an R script tutorial, it would be useful to include a sample YAML, a la Render an R script. It took me a few tries to get it right based on the written instructions -- likely because I read them out of order, but I'm sure I won't be the only one to fail at following instructions.
Hi! I'm following directions on this site: http://happygitwithr.com/rstudio-git-github.html
I did the 7.2 Install Git for Windows. Now I'm working through Appendix A The Shell.
I got to the following line:
If you execute echo $SHELL in Git Bash, you should see /usr/bin/bash.
I kind of saw that but in that it doesn't exist:
I'm running RStudio version 1.1.423.
Any help is appreciated - thanks!
Something deeply weird is going on here:
I'd like to include some information in this repo on getting an .Renviron file setup with a GitHub token stored as GITHUB_PAT.
This is a setup step for my audience (I have to onboard people who need access to private github packages installed via devtools::install_github
). So my focus might be, "This will get you connected to GitHub under the hood, but you can refer to these steps again when using any number of other packages that connect to online APIs." That said, I'm sure the material can be covered in a general way. Happy to take first crack at this.
Reference material:
Hi @jennybc,
I figure you are super-busy right now, so to be clear I have no need for an immediate solution here.
On my Windows machine, I have gone through the steps you outline for SSH on Windows:
Git Bash ->eval $(ssh-agent -s)
-> ssh-add ~/.ssh/id_rsa
.
I can ssh -T [email protected]
and push-pull with RStudio IDE no problem.
When I try to use usethis::use_github()
, I run into a problem. I have traced it to git2r::push()
and can reproduce it:
git2r::push(git2r::repository(usethis::proj_get()), "origin", "refs/heads/master")
Error in .local(object, ...) :
Error in 'git2r_push': error authenticating: failed connecting agent
Also, the problem might be that my corporate load of Windows 7 might be doing something funny.
I know I should work on this to file a proper issue somewhere (once I have a better idea of what the problem actually is), but I wanted to give you a heads-up just in case any of your upcoming students might run into the same thing.
A colleague and I came up with a workaround here. It's a bit of a bear, but we do get it to work.
@jennybc Thanks for providing these excellent materials!
Similar to @graphdr I'm curious how you use git and github (or gitlab) for class. Together with @sanjiverat I have been working on an Rstudio addin to make it a bit easier for students (and faculty) to get started with git and gitlab (see https://github.com/vnijs/gitgadget). The main thing we are still working on is how to best collect and review student pull requests. We plan to create all student accounts in advance and will use the gitlab API to create pull requests on the assignment due date.
@jennybc @daattali What is the most practical approach to review all student pull requests and provide feedback?
I handed this Book off to a colleague to get started with Git (and save me much time, thank you!). They got to 12.4.3.1 without a problem, but I had to field questions on the additional step of creating an SSH config file for macOS >= 10.12.2. It would be great if there were a reference or steps about this in the Book. For many people, I imagine, this may be their first interaction with anything shell related.
Installing "rmarkdown" through rstudio GUI errors due to dependency installation "base64enc". Installing package via install.packages("rmarkdown")
in console successfully completes installation
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ has:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
:-)
or a series of youtube videos that step through the process and give the big picture.
Poll of the useR! git tutorial participants.
What is your OS?
Very interesting and appealing ideas about using markdown to create easy web-pages in Github. For larger documents (eg a statistical analysis plan), should the book make some recommendations such as "For larger documents, you can write a first draft in a word processor such as word, then to enjoy the benefits of Github, use pandoc to convert it to github-flavoured markdown. Alternatively, if you prefer to draft it entirely in markdown, there are a number of markdown editors with features like syntax highlighting and previewing (link to list of recommended editors)"
May simplify things a bit in chapter 81.
I'm running windows 10 with the newest version of both R and Rstudio.
I went to Tools > Shell to open the git bash and the command prompt opens. The box that says “Use Git Bash as shell for Git projects” is checked, but bash never opens. it is always the command prompt.
Any suggestions?
Issue opened for use during Happy Git and GitHub for CSAMA 2017.
Use an emoji reaction on the relevant comment below to indicate which operating system you use.
GitHub vs. Bitbucket vs. GitLab vs. Coding
Repository Management Services Compared
https://medium.com/flow-ci/github-vs-bitbucket-vs-gitlab-vs-coding-7cf2b43888a1#.gn1yq9fkn
and link it up
tl;dr, In the book, can you consider telling Windows users to select "Use Git from the Windows Command Prompt" when installing Git? I believe it prevents the following headache.
I ran into the error described here. My scenario:
which git
in Git Bash returned the git.exe
location.git
commands in Git Bash with no errors. Could set username and email.which git
gave a really long error message.git --version
and git config --global --list
threw the error, bash: git: command not found
.which git
in Git Bash.MSYS
, not cmd.exe
nor MINGW64
, as you warned in the book here.My resolution:
git config --global --list
in Git Bash showed my same username and email. No need to reset.which git
in RStudio's shell returned the git.exe
location.git
commands work in RStudio's shell now.Perhaps this is worth noting in the book? A good spot would be under section 8.1 here, since related notes for Windows users are already there.
Taken by @kevinushey at the useR! tutorial.
New specific ways for RStudio to not find Git. I can mitigate these with changes to the instructions:
git.exe
not git-bash.exe
(windows)I am working with a new Windows surface computer. Fresh out of the box, setup with default settings.
Installed R, Rstudio and Git, again all default settings.
Then tried working through the example in chapter 6 new project, github first. I made a test respository on github. Then went to Create Project in Rstudio. I copied the URL in to Repository URL but didn't make any changes to the "Create project as subdirectory of::" box. This default setting in this box is "~". Somehow or other my Sys.getenv("HOME") on this computer points to a document folder in my OneDrive account.
Meanwhile, Git Bash thinks "~" means "c:/users/karlp" and that's where it installed my gitconfig file.
This lead to no good. Weird and unhelpful error messages and no results.
I finally noticed the actual directory location of the project folder. I started over and created the project at "c:/users/karlp" and everything works as it should.
Wasted a lot of time on this, but did end up reading your whole guide from the beginning and learned the word "bullshittery", so it wasn't a complete loss.
On this page:
You write “verify your version is 1.7.10 or newer,” implying this is required for credentialing.
Near as I can tell, credentialing has been present in Git for a long time, e.g. it is present in our version 1.7.1 on Linux. The only new thing with version 1.7.10 seems to be that it adds credential-osxkeychain:
https://help.github.com/articles/caching-your-github-password-in-git/
where it says: “You need Git 1.7.10 or newer to use the osxkeychain credential helper.”
It’s a good idea to keep git up-to-date (when you can), but this detail sent me on a bit of wild goose chase to understand why some things worked and some things didn’t.
Thanks for a great document!
I was working on a paper, and someone else created new folders and reorganized everything in the repo. She put my paper into a different location in the repository.
Problem #1: what should I do in this situation?
Problem #2: what I did was to try to save the paper and then pull her changes. When I realized I'd messed up, I tried just deleting the paper, but every time I would delete and then git stash
, git would put the papers back into the original folder. And git wouldn't let me pull anything.
Problem #3: I might have actually saved AND committed. That is worse than just saving, isn't it?
Solution: start over
Bigger question: What happened? I guess the answer to Problem #1 should help me understand what happened. But it seems like I should be able to delete the file and then pull. But by having the commit step in there, it seems impossible to delete.
I have some screen shots if you want to see them. Also, I'm doing almost everything inside of R Studio (not sure if that matters).
Thanks!!!
Wednesday June 15
12 - 1pm Troubleshooting installation and setup
1 - 4pm Tutorial
Location: ESB 4192
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.