31

It is possible to directly edit files in a repository stored on GitHub through the web interface. Most of us would never do this but it has its uses.

Edit button on GitHub

I teach an introductory level course. I'd like to use Git and GitHub for homework distribution and collection (GitHub offers free private accounts for education). However, I can't ask completely fresh students to learn Git, at least not in the first few weeks. For the first few weeks I would like to say

"You can upload your homework by clicking on this sequence of buttons on github.com"

and then eventually teach them how to use the command line.

Ideally I'd like for them to be able to upload new files, not just edit existing ones. I can't find a way to do this though. How can I use the GitHub web interface for a similar purpose?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MRocklin
  • 55,641
  • 23
  • 163
  • 235
  • Is using http://gist.github.com an option? – Fred Foo Apr 25 '12 at 15:08
  • Gist is a good idea. Ideally though I'd like to transition to having the students use git proper. I'd also like to interact with their code via command line (for feedback, help with HW, etc...) and use leave comments on the commits. – MRocklin Apr 25 '12 at 15:21
  • 2
    Have the students use the GitHub application for Windows or Mac. It will be easier than the command line. – asmeurer Oct 26 '12 at 20:52
  • 1
    @asmeurer It's often buggy. I'm almost never able to use that. – Blue May 12 '15 at 13:52
  • That feature just evolved yesterday (February 2016). See [my answer below](http://stackoverflow.com/a/35500082/6309) – VonC Feb 19 '16 at 07:54

5 Answers5

8

Since February 2016, you can add/create/upload new files from the GitHub web interface.

See "Upload files to your repositories ":

You can click the “Upload files” button in the toolbar at the top of the file tree.

https://cloud.githubusercontent.com/assets/1369864/12961550/b9a688ea-d006-11e5-96d3-ac91097192a5.png

Or, you can drag and drop files from your desktop onto the file tree.

https://cloud.githubusercontent.com/assets/1369864/12961164/a888b59e-d004-11e5-80a6-e9f32f17c4d5.gif

This replaces the file creation described in the 2012 answer, and add the upload capability (for one or several files).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
3

Note that since early December 2012, you can create new files directly from GitHub:

Create new File

ProTip™: You can pre-fill the filename field using just the URL.
Typing ?filename=yournewfile.txt at the end of the URL will pre-fill the filename field with the name yournewfile.txt.

d

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
MRocklin
  • 55,641
  • 23
  • 163
  • 235
2

I think using gist.github.com is the easiest option. Each gist is a Git repository that can be accessed from the web browser or from the shell, there's a comment button, and although gists are usually single files, they can hold multiple files.

The drawbacks to gists are obviously the cryptic URLs and the fact that you have to copy-paste file contents into the browser unless you use a separate tool.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fred Foo
  • 355,277
  • 75
  • 744
  • 836
1

If you just need to have them edit the same files (assumedly through the web interface), you could create a skeleton repository with empty or basic files, and then have the students fork that.

asmeurer
  • 86,894
  • 26
  • 169
  • 240
0

If you start a new project without a README file, it won't show.

You need at least one file in it. As it's shown in previous answers, you can drag your files or select it using finder or file explorer.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tom Salles
  • 11
  • 3