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?
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!
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.
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.
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).
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.
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
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. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With