Can't push to own public gist

Hi, I created and cloned public gist.
Now I am trying to push some new files to it.
The result I am getting is:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ‘

What do I do wrong?

1 Like

Ok, I played a bit more with it: I can’t add files in sub-dirs. Is this expected?

1 Like

Hi there. 👋

What you’re trying to do simply won’t work, since a gist is one file, mostly use to share snippets and such, what you want to be using is a repository, where you can have multiple files in one place, to do that click your avatar in the top right corner, click on Your GitHub profile to take you to the GitHub main site, now click the + icon next to your avatar and choose New repository and go through the steps there. :+1:

You can read more in depth on the documentation, here’s some useful pages.

Hope that is helpful to you. :slightly_smiling_face:

1 Like

Sorry, @thinkverse, but your answer is not useful. Gists allow multiple files and pull/push operations. I had my reasons to try them instead of standard repos.

1 Like

Hi @vmakieienko, welcome to the GitHub Support Community!

Yes, this is expected. Gists can contain multiple files but only on the same directory level. As Gists are intended for sharing snippets of code—usually embedded on other sites—they were designed to show all the code on the same page at the same time and can’t contain directories at all.

If your project needs a directory structure then we’d recommend using a regular repository instead.

1 Like

Hi @thomasshaped, is there any chance this limitation gets clearly communicated via documentation? I have seen instructions on how to push/pull to/from gits and some lines like “this is just another git repo”(not sure where though), but nothing regarding levels limitation.


Here is the definition from the GitHub glossary on Gists.

A gist is a shareable file that you can edit, clone, and fork on GitHub. You can make a gist public or secret, although secret gists will be available to anyone with the URL.

There is also this section about Editing and sharing content with gists. :slightly_smiling_face:

1 Like

From link you provided:

Gists are actually Git repositories, which means that you can fork or clone any gist, even if you aren’t the original author. You can also view a gist’s full commit history, including diffs.

I would say “single level only repositories” would be more clear.