Skip to content

New GitHubGist

Howard Wolosky edited this page Oct 5, 2020 · 1 revision

New-GitHubGist

SYNOPSIS

Creates a new gist on GitHub.

SYNTAX

FileRef (Default)

New-GitHubGist [-File] <String[]> [-Description <String>] [-Public] [-AccessToken <String>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

Content

New-GitHubGist [-FileName] <String> [-Content] <String> [-Description <String>] [-Public]
 [-AccessToken <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Creates a new gist on GitHub.

The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub

EXAMPLES

EXAMPLE 1

New-GitHubGist -FileName 'sample.txt' -Content 'Body of my file.' -Description 'This is my gist!' -Public

Creates a new public gist with a single file named 'sample.txt' that has the body of "Body of my file."

EXAMPLE 2

New-GitHubGist -File 'c:\files\foo.txt' -Description 'This is my gist!'

Creates a new private gist with a single file named 'foo.txt'. Will populate it with the content of the file at c:\files\foo.txt.

EXAMPLE 3

New-GitHubGist -File ('c:\files\foo.txt', 'c:\other\bar.txt', 'c:\octocat.ps1') -Description 'This is my gist!'

Creates a new private gist with a three files named 'foo.txt', 'bar.txt' and 'octocat.ps1'. Each will be populated with the content from the file on disk at the specified location.

PARAMETERS

-AccessToken

If provided, this will be used as the AccessToken for authentication with the REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Content

The content of a single file that should be part of the gist.

Type: System.String
Parameter Sets: Content
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

A descriptive name for this gist.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-File

An array of filepaths that should be part of this gist. Use this when you have multiple files that should be part of a gist, or when you simply want to reference an existing file on disk.

Type: System.String[]
Parameter Sets: FileRef
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-FileName

The name of the file that Content should be stored in within the newly created gist.

Type: System.String
Parameter Sets: Content
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Public

When specified, the gist will be public and available for anyone to see.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

String - Filename(s) of file(s) that should be the content of the gist.

OUTPUTS

GitHub.GitDetail

NOTES

RELATED LINKS

PowerShellForGitHub

Docs

PowerShellForGitHub

Functions

Clone this wiki locally