Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mroderick/1afdd71aa69f6b29601d335751a1a9be to your computer and use it in GitHub Desktop.
Save mroderick/1afdd71aa69f6b29601d335751a1a9be to your computer and use it in GitHub Desktop.
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
@sowrovsarkar63
Copy link

Linkedin Banner

@yxyydev
Copy link

yxyydev commented Jun 14, 2022

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

@yxyydev
Copy link

yxyydev commented Jun 15, 2022

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

@sowrovsarkar63
Copy link

Awesome

@real-yfprojects
Copy link

Not working for me:

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

@sowrovsarkar63
Copy link

sowrovsarkar63 commented Aug 28, 2022

Just push in master branch

@real-yfprojects
Copy link

Just push in master branch

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

@alfonmga
Copy link

Screenshot 2022-08-30 at 17 24 26

@sowrovsarkar63
Copy link

Screenshot_3
check it out

@tlcoles
Copy link

tlcoles commented Oct 1, 2022

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!

@steinarb
Copy link

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$

@Abinashbunty
Copy link

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

@steinarb
Copy link

steinarb commented Feb 9, 2023

Ah! Thanks!

@seanjensengrey
Copy link

Legit! The comment drop technique is wonderful.

@CodeByAidan
Copy link

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

you cannot be serious.... 💀💀💀💀

@steezeburger
Copy link

steezeburger commented Nov 14, 2023

I kept having weird auth issues with https. When it would try to auth me with Github in the browser, I would just get a 404.

I switched to ssh (fyi you must create an ssh key and add the public key to Github settings), remembering to change the repo remote, e.g.

git remote set-url --push origin [email protected]:<some_gist_hash>.git

This worked, and I was able to commit and push images to the gist repo.

@o-az
Copy link

o-az commented Nov 26, 2023

ansi-color-codes

@src-ry
Copy link

src-ry commented Jan 9, 2024

download

@shalva97
Copy link

image

@CodeByAidan
Copy link

If you get an error saying:

error: src refspec master does not match any
error: failed to push some refs to 'https://gist.github.com/<hash>.git'

Since your repository has a branch named "main", you should push your changes to that branch instead of "master". To push to the "main" branch, use the following command:

git push origin main

This command will push the changes in your local "main" branch to the remote repository.

@moshiurH
Copy link

^ Agreed, change from git push origin master to git push origin main.

@sullemanhossam
Copy link

sullemanhossam commented Jun 13, 2024

@codebydant
Copy link

The command with ssh is:

git clone [email protected]:HASH.git

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