Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload images like png into GitHub repository?

I'm a newbie to Git or GitHub, and didn't find how to upload an image file into my repo in Git? Any idea?

like image 912
macchiavalley Avatar asked May 11 '14 18:05

macchiavalley


People also ask

Can I upload JPG to GitHub?

You can drag and drop the image from your computer to a comment field in GitHub. Wait for the file to upload and then the URL to the image is right there!

How to upload images to a GitHub repository?

Update: Github has released Upload option for repositories! yushlux's answer is fine for someone using CLI. But for uploading images to Github through a browser can be done this way. Use prose.io for editing and inserting images in any files in your repo but make sure you create a _prose.yml file in the root of the repo and add this code inside.

How to upload PNG files to GitHub?

You need to add and commit the png file to your local repo first. Then push the updates to the remote server. Show activity on this post. Although github does not have a CDN support, but you can use Issues to upload content like images and PDF. Here is how you can do it. After submitting the issue, github will show you the preview of your image.

How do I add images to my GitHub wiki page?

On GitHub, navigate to the main page of the repository. Under your repository name, click Wiki. Using the wiki sidebar, navigate to the page you want to change, and then click Edit. On the wiki toolbar, click Image. In the "Insert Image" dialog box, type the image URL and the alt text (which is used by search engines and screen readers).

How to automatically upload images from picgo to GitHub?

You can customize it at: Now you can select some images in your folder or copy a image to your clipboard, then use the shortcut key to automatically upload them to your GitHub repo. Then you can click the PicGo icon and click the latest image to copy the image url in markdown format.


2 Answers

You need to add and commit the png file to your local repo first. Then push the updates to the remote server.

git add xxx.png git commit -m 'add png file' git remote add origin https://github.com/xxx.git git push -u origin master 
like image 194
yushulx Avatar answered Sep 20 '22 07:09

yushulx


Although github does not have a CDN support, but you can use Issues to upload content like images and PDF.

Here is how you can do it.

  1. Goto Issues
  2. Create New Issue
  3. Drag your image to the content area
  4. Submit the issue

After submitting the issue, github will show you the preview of your image. You can just right click, copy the URL and use it.

This approach saves you from add-commit-push cycle. Also your repo stays light weight as you don't have to keep your images in the repo.

like image 39
Kaunteya Avatar answered Sep 21 '22 07:09

Kaunteya