GH-GIST-CREATE(1) GitHub CLI manual GH-GIST-CREATE(1)

# [NAME](#NAME)

gh-gist-create - Create a new gist

# [SYNOPSIS](#SYNOPSIS)

**gh gist create \[&lt;filename&gt;... | &lt;pattern&gt;... | -] \[flags]**

# [DESCRIPTION](#DESCRIPTION)

Create a new GitHub gist with given contents.

Gists can be created from one or multiple files. Alternatively, pass **-** as filename to read from standard input.

By default, gists are secret; use **--public** to make publicly listed ones.

# [OPTIONS](#OPTIONS)

[**-d**, **--desc** **&lt;string&gt;**](#d)

A description for this gist

[**-f**, **--filename** **&lt;string&gt;**](#f)

Provide a filename to be used when reading from standard input

[**-p**, **--public**](#p)

List the gist publicly (default "secret")

[**-w**, **--web**](#w)

Open the web browser with created gist

# [ALIASES](#ALIASES)

gh gist new

# [EXIT CODES](#EXIT_CODES)

0: Successful execution

1: Error

2: Command canceled

4: Authentication required

NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.

# [EXAMPLE](#EXAMPLE)

```
# Publish file 'hello.py' as a public gist
$ gh gist create --public hello.py
# Create a gist with a description
$ gh gist create hello.py -d "my Hello-World program in Python"
# Create a gist containing several files
$ gh gist create hello.py world.py cool.txt
# Create a gist containing several files using patterns
$ gh gist create *.md *.txt artifact.*
# Read from standard input to create a gist
$ gh gist create -
# Create a gist from output piped from another command
$ cat cool.txt | gh gist create
```

# [SEE ALSO](#SEE_ALSO)

[**gh-gist(1)**](/man/os/gh/gh-gist.1)

Oct 2026

---

Document: gh-gist-create(1) from gh 2.103.3-r1 (Chainguard OS)
Source: https://github.com/cli/cli
