Copy a Snippet File's Contents

There are two ways you can copy the contents of a snippet file, You can copy the contents manually from the Snippets page or you can insert them from the context menu in the code editor.

You'll be using the code editor when you edit a variety of pages and input fields: in the Edit Wiki page, when you're editing the readme file, using the snippet file editor, entering text in the merge request comment box, and filling out the shell command box on the Configure Build page.

To get the text you want to use from the snippet file:

Action How To

Copy from the Snippets page

  1. Open the snippet.

  2. For the file whose contents you want to copy, click Copy the copy icon.

    In some browsers, you must press Ctrl+C to copy the content to the clipboard after clicking Copy the copy icon.

  3. Paste the contents into the text field.

Insert from the context menu

  1. In the code editor, right-click, and select Insert from Snippet.

  2. In the Select Snippet page of the Insert From Snippet wizard, select the snippet, and click Next.

  3. In the Select File page, click the file name whose contents you want to insert.

  4. Click Finish.