How to push Gist? #62203
-
Select Topic AreaQuestion BodyDear all, I cloned a Gist:
After editing the file, when I push to update the Gist, I get an error:
I thought the problem was my username missing from the URL, so i tried to update the URL
But it made no difference. How to update (push) to a Gist? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Hey, When you clone a Gist using Git, you are essentially creating a read-only copy of the Gist content on your local machine. You can make changes to the files locally, but there is no direct way to push those changes back to the original Gist through Git. If you want to update the content of a Gist, you can do so by visiting the Gist page on the GitHub website, making the changes there, and then clicking the "Update gist" button to save the changes. You'll need to be logged in to your GitHub account to be able to update the Gist. Hope this helps! |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
Hi, I didn't understand that Gists were a read-only repository. I will update directly on the GitHub page. Thank you. |
Beta Was this translation helpful? Give feedback.
-
Closing ticket |
Beta Was this translation helpful? Give feedback.
-
Hi @marcelomgarcia gist_hash="<the-gist-hash>"
gist_local_dir="<a-better-name-for-the-local-gist>"
git clone git@gist.github.com:${gist_hash}.git "${gist_local_dir}"
cd "${gist_local_dir}"
# change files + git add + git commit
git push
# there should be a new revision in your gist under *revisions* Important Gist does not support directories. You will get an error from a pre-hook if you try to push a commit that includes directories (so nothing will change in your gist). |
Beta Was this translation helpful? Give feedback.
Hey,
When you clone a Gist using Git, you are essentially creating a read-only copy of the Gist content on your local machine. You can make changes to the files locally, but there is no direct way to push those changes back to the original Gist through Git.
If you want to update the content of a Gist, you can do so by visiting the Gist page on the GitHub website, making the changes there, and then clicking the "Update gist" button to save the changes. You'll need to be logged in to your GitHub account to be able to update the Gist.
Hope this helps!