Reputation: 1091
https://github.com/rdpeng/ExData_Plotting1/tree/master/figure
Above you can see someone uploading images to Github without using gimmicks like "Issues" or "Wiki". My "desktop" version of Github has issues and I don't think it has an option to upload images. Since the "desktop" version won't work in command prompt either - is there a "normal" way to upload images to Github?
P.S: Is there a reason why this is so complicated? I can see questions on Stackoverflow and blog posts about this (none of which solves the problem) ...
Upvotes: 2
Views: 344
Reputation: 508
You can now drag and drop an image file on wiki page in edit mode.
https://github.blog/changelog/2022-02-14-upload-images-to-wiki-pages
Hacks like uploading an image to a github issue are no longer required.
Start by editing your wiki page. Then drop an image file into the browser window. The file gets uploaded, a link to the uploaded file is created and added to your wiki text like this in markdown:

Here is the actual image:
Upvotes: 0
Reputation: 125007
is there a "normal" way to upload images to Github?
The "normal" way to do it is to add the images to your local copy of the repository and then use git
to commit your changes and push them to the remote repo, which is Github. So it's be something like:
$ git add myImage.png
$ git commit -m "Adding myImage.png"
$ git push origin
Is there a reason why this is so complicated?
It's really not complicated unless you don't know how to use git
or at least have some experience with other version control systems. git
and Github began as (and largely remain) tools that programmers use to share source code files, and your R
files qualify as source code.
It is complicated, though, if you're looking at Github as some kind of web hosting service. You have to realize that a git
repository tracks all the changes you make to the files it contains -- it's a lot more than just a directory with files. There are quite a few basic guides to git
and Github, and reading one of those would be a good way to start shifting your perspective. It looks like you're taking Exploratory Data Analysis with Roger Peng, perhaps through Coursera? You'll use Github to share all your assignments in that class, so getting comfortable with git
now will pay dividends for the rest of the class.
My "desktop" version of Github has issues and I don't think it has an option to upload images.
Again, it sounds like you mostly need to change your perspective. Your installation of "Github Desktop" may indeed have issues, although it's usually a pretty straightforward installation. Github and git
don't much care whether a file is a .R file, an image, your weekly shopping list, or any other file. If you've: 1) created a repository on Github; and then 2) cloned that repo to your local machine; then you should have a local directory on your machine that's a copy of what's in your Github repo. You can create files in that directory or copy them there, and then use git add
to add them to the list of files that git
tracks. Use git commit
to create "a commit" which contains all your changes since the previous commit. Use git push
to copy your commits, and thus all your changes, from your local copy of the repo to the one on Github. You can do some of these steps through Github Desktop if you like, but in order to understand what to do in Github Desktop it helps to have a handle on the underlying git
commands.
Upvotes: 4