Can you clone GitLab snippets?

久未见 提交于 2020-07-04 12:01:34

问题


It's easy enough to create them, but I can't find out how to clone them and edit offline.

Is it possible?


回答1:


May 2020, for GitLab 13.0: yes!

Versioned Snippets

Snippets are useful for sharing small bits of code and text that may not belong in the main project’s codebase.

These items are important to groups and users who rely on them for other tasks, like scripts to help generate diagnostic output or setup supporting services for testing and demo environments.

Unfortunately, a lack of version control has made it hard to know if a snippet was the latest version or what changes may have happened and how to reconcile those.

Snippets in GitLab are now version controlled by a Git repository.

When editing a Snippet, each change creates a commit. Snippets can also be cloned to make edits locally, and then pushed back to the Snippet repository.

This is the first step in enabling more collaboration on Snippets.
In future releases we’ll introduce support for multiple files, continue to expand features and expand permissions.

See documentation and issue.


2015: original answer: Not directly.

Gitlab already have snippets section under each project.
Like: http://gitabhq.com/project-name/snippets/

But it is not available for cloning.

There was a request for a GitHub Gist-like feature for GitLab (based on Gistie), also asked in GitLab suggestions.
But that was not implemented at the time.


Update 2019, as commented by eli, and documented in "Downloading snippets" (GitLab 10.8+)

For now its just possible to download snippets, e.g.

https://gitlab.com/snippets/SNIPPET_ID/raw?line_ending=raw – 


来源:https://stackoverflow.com/questions/33906431/can-you-clone-gitlab-snippets

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!