1

How to add an image to a gist

 1 year ago
source link: https://gist.github.com/mroderick/1afdd71aa69f6b29601d335751a1a9be
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
How to add an image to a gist

How to add an image to a gist

  1. Create a gist if you haven't already.

  2. Clone your gist:

    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone [email protected]:<hash>.git     # or with ssh
  3. Add your image to your gist's repository:

    git add your-image.jpg
  4. Commit the image:

    git commit -m "Add image"
  5. Update gist:

    git push origin master
tulip.jpg

For those that are not as familiar with command line can do it another way. If you open the issues tab of a repo on GitHub, you can drag and drop the file into an Issues and it will create a link that you can easily add to Gist. Paste the link into the Gist and save the Gist as a .md file.

Great resource 1st_place_medal

Author

For those that are not as familiar with command line can do it another way. If you open the issues tab of a repo on GitHub, you can drag and drop the file into an Issues and it will create a link that you can easily add to Gist. Paste the link into the Gist and save the Gist as a .md file.

That's a great tip!

thank you +1

Awesome Tip +1

Thanks! +1

thanks for the steps- my suggestion is that don't you think a link on what is gist is will.

Thanks for sharing. For those who get authentication errors while running git push origin master like me, try to create a new personal access token at https://github.com/settings/tokens and use that one instead of your GitHub password (see https://stackoverflow.com/a/31305980/4964553). This should help, especially if you use two factor authentication.

Thanks for sharing. For those who get authentication errors while running git push origin master like me, try to create a new personal access token at https://github.com/settings/tokens and use that one instead of your GitHub password (see https://stackoverflow.com/a/31305980/4964553). This should help, especially if you use two factor authentication.

Worked for me, thanks!

Thanks

Any idea if this can be done with octokit's rest api?

Nice, i once tried to copy paste the bytes and it didnt work ofc

You can also just convert image to SVG...

so easy in hindsight - thanks Morgan!

Hi,
Easier would be to comment your Gist and add an image there.
Copy past the image in your gist. image

image

Hi,
Easier would be to comment your Gist and add an image there.
Copy past the image in your gist. image

image

Even easier - thanks iMhack

Linkedin Banner

Hi,
Easier would be to comment your Gist and add an image there.
Copy past the image in your gist. image

image

Even easier - thanks iMhack

b4661d50-1888-4ee9-848c-9598b296fb46-removebg-preview

Hi, Easier would be to comment your Gist and add an image there. Copy past the image in your gist. image

image

WhatsApp_Image_2022-06-11_at_18 04 01-removebg

Not working for me:

> git push origin main
remote: Permission to write to gist denied.
The requested URL returned error: 403

Just push in master branch

Just push in master branch

There is no master branch. It is named main in this case.

Screenshot 2022-08-30 at 17 24 26

Screenshot_3

check it out

Did a search for this info and, look, it's you!

Friend, thank you for how you give back to the community and to us learners! Big hugs!

Not working for me, unfortunately:

sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$ git push origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://gist.github.com/a64609f7e46dc52776685ba86a8e3005.git'
sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$ git branch
* main
sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$ git push origin main
Username for 'https://gist.github.com': steinarb
Password for 'https://[email protected]': 
remote: Repository not found.
fatal: repository 'https://gist.github.com/a64609f7e46dc52776685ba86a8e3005.git/' not found
sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$

Not working for me, unfortunately:

sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$ git push origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://gist.github.com/a64609f7e46dc52776685ba86a8e3005.git'
sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$ git branch
* main
sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$ git push origin main
Username for 'https://gist.github.com': steinarb
Password for 'https://[email protected]': 
remote: Repository not found.
fatal: repository 'https://gist.github.com/a64609f7e46dc52776685ba86a8e3005.git/' not found
sb@marquez:/tmp/a64609f7e46dc52776685ba86a8e3005$

@steinarb You have to use only git push without the origin master

Ah! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK