Giter VIP home page Giter VIP logo

happy-git-with-r's Introduction

happy-git-with-r's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

happy-git-with-r's Issues

Syncing a fork in the browser with GitHub is not a sustainable workflow

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.

Update advice re: GitHub Education

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?

Notes for GitHub use in classroom

2016 outline (most of these requests have additional info in the body btw):

  • get GitHub username via Shiny form app
  • ping them to make sure exist GET /users/:username
    • all did (!!) but some typos, of course, which were all valid usernames, which meant I invited randos to join the org at first (all straightened out now)
  • create 2016_students name and store id POST /orgs/STAT545-UBC/teams
  • invite students to join the team (and therefore org) PUT /teams/:id/memberships/:username
  • create student-specific repos POST /orgs/STAT545-UBC/repos
  • add student as collaborator PUT /repos/STAT545-UBC/:repo/collaborators/:username
  • grant 2016_students team read access to all student repos PUT /teams/:id/repos/STAT545-UBC/:repo
  • unwatch all the repos personally DELETE /repos/:owner/:repo/subscription
  • iterate endlessly as students gradually register, fill out the form, etc.

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.

use of git with students

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

git config worth considering

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:

  • branches are pushed to their upstream branch
  • no push if remote branch name != local branch name, unless explicitly specified via 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 remote

Conclusion: 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.

troubleshooting confusion over SSH vs HTTPS

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?]

RStudio not recognising Git in windows 7 64bit system

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.

RStudio not recognising Git.docx

warning: push.default is unset

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
  • Relevant stackoverflow

    "...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

    • Edit: Unclear if XCode installation was responsible for the issue. Student squelched warning message with git config --global push.default simple

RStudio not finding Git on Mac OS

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):

  • both installed from here: https://git-scm.com/downloads
    • for the 10.9.5 machine, we worked with git 2.8.1 intel universal mavericks
    • should my Mac git install instructions have an option 0, which is to do nothing and use git that ships with mac os?
    • why do I not mention Xcode command line tools here? does it not install git?
    • should I sell homebrew harder?
  • which git revealed a git executable for both
  • git could be used from the command line for both
  • echo $PATH revealed that the location of the git executable was indeed on the path
  • we restarted RStudio, Terminal, logged out, logged back in ... nothing helped
  • we could point RStudio at the git executable, i.e. the Tools > Project or Global Options > Git/SVN dialogue box appeared to refer to the desired executable
  • RStudio was very current (both running Preview?)

But we don't get the Git tab in upper right pane. Can't check "create git repo" for new projects. Etc etc.

Deployment

@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:

https://bookdown.org/yihui/bookdown/publishing.html

SSH keys

@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.

heads up

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.

@daattali @BernhardKonrad @ttimbers @mgelbart @Anmol6

happy-docker-with-r

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

CONTRIBUTING?

Could you add a CONTRIBUTING.md document with guidelines on how to contribute to this project? It's an exciting endeavor!

bash: remote: command not found

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:

image

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):

image

Include material on environmental variables/GITHUB_PAT

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:

Issue and workarounds for git2r + Windows + SSH

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.

collecting and reviewing student pull requests

@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?

Additional instructions needed in 12.4.3.1 (SSH setup macOS)

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.

19.9 - rmarkdown installation error

Installing "rmarkdown" through rstudio GUI errors due to dependency installation "base64enc". Installing package via install.packages("rmarkdown") in console successfully completes installation

Markdown text editor

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)"

Command Prompt open in R instead of Bash

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?

Windows: "bash: git: command not found" error thrown in RStudio shell, but not in Git Bash

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:

  • Windows 10 (64-bit). Had latest versions of R ("short summer") and RStudio (1.1.383).
  • Had latest version of Git from here.
  • Running which git in Git Bash returned the git.exe location.
  • I was able to run all git commands in Git Bash with no errors. Could set username and email.
  • I then opened an existing R project already under version control in RStudio ("Git" menu was visible).
  • Running which git gave a really long error message.
  • Running git --version and git config --global --list threw the error, bash: git: command not found.
  • I confirmed that "Version control system:" in Tools > Project Options > Git/SVN was set to "Git".
  • I confirmed that "Git executable" in Tools > Global Options > Git/SVN was set to the same exact path as shown by running which git in Git Bash.
  • I confirmed that the “Use Git Bash as shell for Git projects” box in Tools > Global Options > Git/SVN was ticked. Edit: This option is not in RStudio v1.1.383. My confusion.
  • Name of the Rstudio git shell window was MSYS, not cmd.exe nor MINGW64, as you warned in the book here.

My resolution:

  • Re-installed git from here (did not uninstall).
  • During installation, selected "Use Git from the Windows Command Prompt" (different from default). Left all other options throughout the installation at their default settings.
  • Running git config --global --list in Git Bash showed my same username and email. No need to reset.
  • Running which git in RStudio's shell returned the git.exe location.
  • All git commands work in RStudio's shell now.
  • Am able to set username and email in RStudio's shell.

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.

notes on RStudio finding Git

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:

  • make sure to specifygit.exe not git-bash.exe (windows)
  • always install Xcode command line tools (mac)
  1. Some Windows users choose the incorrect git executable (e.g. 'git-bash.exe' vs 'git.exe') and as a result git integration doesn't work. (I remember one case in the past where a user basically locked
    themselves out of the IDE because they set the wrong git executable and RStudio's attempts to run it on startup froze the system).
  2. OS X users can't use Git unless command line tools are installed, even if a custom version of Git is installed and pointed to by RStudio. Except for El Capitan, where this problem is not seen. Related to #8. (This will presumably get fixed in the IDE.)

tilde troubles

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.

Git Versions and Credentials

On this page:

http://happygitwithr.com/credential-caching.html#verify-that-your-git-is-new-enough-to-have-a-credential-helper

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!

merge conflicts #1

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!!!

Practice session

Wednesday June 15

12 - 1pm Troubleshooting installation and setup
1 - 4pm Tutorial
Location: ESB 4192

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.