Problems downloading from github

33 views
Skip to first unread message

Andrew Gelman

unread,
May 25, 2017, 7:40:15 PM5/25/17
to Stan users mailing list
Hey, I wanted to download the files from this case study:
https://github.com/stan-dev/example-models/tree/master/knitr/soil-carbon
I first tried to just right-click on the file names but then everything was saved as html. So instead I went to the files one at time, first clicking to see the source code, then right-clicking Raw to save on my disk. It did the R files fine, but when I did the Stan files it added an unnecessary .txt extension which I had to manually remove.
Whassup with that?
Is there an easier way to download files from Github?
Thanks
Andrew


Ben Goodrich

unread,
May 25, 2017, 9:58:48 PM5/25/17
to Stan users mailing list, gel...@stat.columbia.edu
On Thursday, May 25, 2017 at 7:40:15 PM UTC-4, Andrew Gelman wrote:
Is there an easier way to download files from Github?

Bob Carpenter

unread,
May 26, 2017, 12:54:01 AM5/26/17
to stan-...@googlegroups.com
As Ben pointed out, you can download the whole repo as a tarball.
That's fine if you just want to use something, but then you don't
have a good way to make changes. We all clone the repo, but you
won't be able to do that until you're ready to use the command
line or find some GUI wrapper.

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

Andrew Gelman

unread,
May 26, 2017, 4:11:33 PM5/26/17
to stan-...@googlegroups.com
No big deal, just kinda weird that it automatically renames files as .txt and then I have to go strip those suffixes. I can live with it, it just seems strange.
A

Bob Carpenter

unread,
May 28, 2017, 3:18:02 PM5/28/17
to stan-...@googlegroups.com
I don't know of any situation in which GitHub would add a .txt suffix.
Which file do you think is being renamed in what situation?

- Bob

Andrew Gelman

unread,
May 28, 2017, 4:19:50 PM5/28/17
to stan-...@googlegroups.com
Hi, as I noted in my first email, it was an R file. That it, it was a file with a .R extension. Maybe it was not Github that added the .txt suffix. Maybe it was my Mac operating system that did it. Again, no big deal, just kind of weird, a Clippy-like situation where the computer is trying too hard to solve my problem for me, and where I'd rather have the "dumb" solution of just keeping the file as it's named.
A

Michael Betancourt

unread,
May 28, 2017, 5:17:47 PM5/28/17
to stan-...@googlegroups.com
Github is not meant to be an online file source, like
Dropbox, where you can manage and download
files like you do on your local computer. Many of
the files are served as text for all kinds of technical
reasons, which complicates attempts at
downloading the files straight from the browser.

Andrew Gelman

unread,
May 28, 2017, 5:20:27 PM5/28/17
to stan-...@googlegroups.com
I understand. But what if someone tells me he has something on github, and I go there and find the file, and, hey, maybe it's an R script or a Stan program, and I want to download it? Then it's too bad that there are roadblocks along the way.

To put it another way: Sure, I understand what you're saying to the extent that Github is a version control system for collaborations. But Github is not _only_ that. Github is also a way for people to post files for others to download.

A

Michael Betancourt

unread,
May 28, 2017, 5:31:16 PM5/28/17
to stan-...@googlegroups.com
>
> I understand. But what if someone tells me he has something on github, and I go there and find the file, and, hey, maybe it's an R script or a Stan program, and I want to download it? Then it's too bad that there are roadblocks along the way.
>
> To put it another way: Sure, I understand what you're saying to the extent that Github is a version control system for collaborations. But Github is not _only_ that. Github is also a way for people to post files for others to download.

Github actively does _not_ want to encourage that behavior.
It increases their serving costs without any real benefit to
them; again, they are not Dropbox nor do they want to be.

In a very real sense this is hard not because it can’t be easy
but because they don’t want it to be easy.

Andrew Gelman

unread,
May 28, 2017, 5:38:22 PM5/28/17
to stan-...@googlegroups.com
I still don't understand. People all the time say, Hey, my code is on Github, go play with it!
I guess if Gtihub wants to discourage that behavior, that's fine, but I have to say that this dissuades me from wanting to use Github. But I guess your point is that I'm not part of Github's intended audience! After all, if someone has a foo.R file on Github and wants to share it with me, this person can always just email me the file.
A

Bob Carpenter

unread,
May 28, 2017, 5:43:02 PM5/28/17
to stan-...@googlegroups.com
You guessed right. If you nav to a browser view of a file on GitHub

https://github.com/stan-dev/example-models/blob/master/BPA/Ch.03/3.3.1_GLM_Poisson.R

then click "Raw", you get a URL that ends in .R:

https://raw.githubusercontent.com/stan-dev/example-models/master/BPA/Ch.03/3.3.1_GLM_Poisson.R

Safari then drops a turd in the punchbowl by defaulting to saving as
a web archive, then if you ask for text instead with the control, it
adds .webarchive.txt by default to the end of the URL to protect you.

If I use Firefox, it does exactly what you expect and saves it as a file
with a .R extension.

Blame Apple, not GitHub! They're the ones who want to bring you Clippy
in the name of your own security.

- Bob

Bob Carpenter

unread,
May 28, 2017, 5:54:01 PM5/28/17
to stan-...@googlegroups.com
It's repo, not file oriented.

1. To use like Dropbox, download a tarball of the whole repo.

2. To use like GitHub, clone or fork the repo.

3. To download files from the browser, use Firefox or something
else that isn't Safari.

I'd very much like to see you learn how to do (2) so we could
stop with the whole "just email me the file" stuff. For (2), you
either need to learn how to use the terminal (like the rest of us
do) or learn how to use one of the GUI interfaces to GitHub.

The GitHub view you get on the web is of their copy of the world.
It's how we share files by synching with the origin at GitHub.
In the regular use of GitHub, you have a complete
copy of everything locally and just update via pulls. So once
you've cloned, you never have to clone again. You can send and
receive files that automerge with a total of three commands:

add a new file to your local repo

> git add <file>

commit the current version of the file to your local repo:

> git commit -m "explanation of why" <file>

push your changes back to the origin:

> git push

pull down most recent state of origin:

> git pull

That's about all you'd ever be doing with it in the way of commands.
We can worry about all the stuff that makes GitHub so awesome later,
but we need to get you using the basics.

- Bob
Reply all
Reply to author
Forward
0 new messages