How to store GIFs for a Github README? - github

I try to include a GIF for my README.md in Github, since Github allows to use and render GIFs in .md files.
As far as I am concerned I often cannot find any image or video files on Repositories of well maintained Github Repositories, but they still can use their own files in their READMEs.
A few examples:
https://raw.githubusercontent.com/junegunn/i/master/fzf.png
https://raw.githubusercontent.com/vim/vim/master/runtime/vimlogo.gif
How can I achieve similar links, without tracking and pushing e.g. GIFs in my Repo on Github?
I tried out the following:
I open an issue in my Repo, drag and drop my .gif file into it, copied the content into my README.md.
This turns out successfully, but i receive an not readable link:
https://user-images.githubusercontent.com/21893471/47281234-9f9b23ff-21ff-88ad-98f1-5555d1239ba807.gif
(dummy link)
I followed this description. It also works, but then an extra branch is created and thus the GIFs will be downloaded as well when someone clones the Repository.

TL;DR; You can't.
Those "readable" links are links directly into content stored in that repository. For example, that Vim image lives in this directory in the code: https://github.com/vim/vim/tree/master/runtime, and will be downloaded by anyone who clones the repository.

Related

Github prepends "https://github.com/user/repo/blob/main/" to all links in readme.md

I have a private repository on GitHub that contains a readme.md file with links to Kaggle datasets. When viewing the repo on github prepends "https://github.com/{user}/{repo}/blob/main/" to the url, breaking it.
Why is this happening, and how do I change this behavior?
For what it's worth, I'm also using git-lfs, though I can't find any documentation of this behavior associated with that, either.
I ended up figuring this out on my own. The URL was missing a scheme, and github was treating it like a relative link to something in the repository. This was my mistake and not an issue with github.

github markdown no longer displays images

A month or 2 ago I wrote a markdown file for my github page and it contained png files.
Today I was looking ad the markdown file on github and all images were removed. If I click on one I get the message: The image "link to image" cannot be displayed because it contains errors.
This is the link as the git hub page gives me
https://raw.githubusercontent.com/bask185/State-Machine-Scripts/master/images/handleWheel.png
And this is how I try to display the file in the markdown file.
exclamation mark [handleWheel ] (https://raw.githubusercontent.com/bask185/State-Machine-Scripts/master/images/handleWheel.png)
It worked once so I did something right once. Did github changed or did I do something wrong?
Can I salvage my images?
It looks like the images were linked to a relative path in your repository. You earlier had an images/ directory with the images that were shown in the markdown file, but this was removed in this commit.
If you browse the repository at the previous commit, you can see the images. The image corresponding to the link in your question, for example, is here.
This thread discusses various ways to add images to Markdown files in GitHub.

GitHub Pages is not serving PNG files

The documentation for geoplot is rendered via GitHub Pages, off of the gh-pages branch of its repository. However, some of the images on the following page fail to render: https://residentmario.github.io/geoplot/quickstart/quickstart.html.
Take as an example the image QuickStart_21_2.png and the image QuickStart_10_1.png. Both of these files are located in the _images folder in the gh-pages branch of the repository, but whilst the former is served correctly, the latter serves a 404.
Why would these files not be rendered?
This turned out to be due to some interesting dynamics around filename casing conventions and (probably) some kind of intermediate cache at GitHub. More details here: https://github.com/ResidentMario/geoplot/issues/175.

How to move an image to a folder GitHub

I want to move an image in my GitHub repository to a new folder. I know to move a text file you can click the edit icon in the top right but there is no edit icon for pictures. How can I move the picture on GitHub in the browser?
Update: The OP changed the title after my answer. The original question said GitHub Desktop not GitHub Browser - https://stackoverflow.com/posts/52977306/revisions
GitHub Desktop tracks all changes to all files as you edit them directly in the file system.
Just move the files directly using Windows Explorer and commit your changes to the repository using GitHub Desktop after moving the file.
Step-by-step instructions here:
Committing and reviewing changes to your project
You might also be interested in reading the other topics in the documentation, to get up to speed:
https://help.github.com/desktop/guides/contributing-to-projects/
Images are binary data. Adding, removing, and even updating those images can cause unnecessary usage of your repository's space. This is because images, videos, and other binary data are larger than the text files where our code is written. For personal projects, one could use this site (or another) to upload all of your images: https://imgbb.com/. Then URLs of each image will be provided for use anywhere in an app without the need to store those images in an actual repo.

Use github website purely - upload to add files

I'm trying to purely use the website Github to create a repo, then public first commit. (Because I cant install the desktop client on this computer, nor use the command line, school restrictions)
I found a little cheat, I clicked the "make readme" button then renamed that file to make the first commit.
I created a screncast here:
Youtube :: Use Github without the Desktop App
After that I can create new text based files by clicking "+" button and create subdirectories too. But I don't know how to upload image, other text based files, or other non-text files to the repo using just the website. Does anyone know?
GitHub's web interface isn't designed as a complete Git solution. It allows you to do a subset of the operations you could do in a local clone, including just about every part of GitHub Flow.
Their documentation about adding files only covers adding text files using the online editor, which you have already discovered. I don't believe that it supports uploading files.