Search code examples
gitlabcode-snippetsgitlab-omnibus

How to download a snippet in GitLab CE (Community Edition, locally hosted)?


There is no download link. Would prefer command line. The URL for the snippet is

http://gitlab.server.edu/group/project_name/snippets/3

The URL for what I get when I click "Raw" is the same thing as above but ends in /raw.

Sorry, can't give real URLs due to privacy.

I know there is a "copy to clipboard" button, but that won't work on a cluster.

EDIT Looks like raw.githack.com will do gitlab, but that won't work for an internal installation.


Solution

  • You can check if this issue applies in your case:

    The contents of a private snippet can be read by sending the following request to the GitLab API:

    curl --header "PRIVATE-TOKEN: XXXXXXXXXXXXXX" "http://gitlab-instance/api/v3/projects/1/snippets/6/raw"