Publishes an unpublished codespace, creating a new repository and assigning it to the codespace.The codespace's token is granted write permissions to the repository, allowing the user to push their changes.This will fail for a codespace that is already published, meaning it has an associated repository.You must authenticate using a personal access token with the codespace scope to use this endpoint.GitHub Apps must have write access to the codespaces repository permission to use this endpoint.
Path to devcontainer.json from repo root used to create Codespace.
Example:
.devcontainer/example/devcontainer.json
display_name
string  | nullÂ
optional
Display name for this codespace.
Example:
bookish space pancake
environment_id
string  | nullÂ
required
UUID identifying this codespace's environment.
Example:
26a7c758-7299-4a73-b978-5a92a7ae98a0
git_status
objectÂ
required
Details about the codespace's git repository.
ahead
integerÂ
optional
The number of commits the local repository is ahead of the remote.
Example:
0
behind
integerÂ
optional
The number of commits the local repository is behind the remote.
Example:
0
has_uncommitted_changes
booleanÂ
optional
Whether the local repository has uncommitted changes.
has_unpushed_changes
booleanÂ
optional
Whether the local repository has unpushed changes.
ref
stringÂ
optional
The current branch (or SHA if in detached HEAD state) of the local repository.
Example:
main
id
integerÂ
required
Example:
1
idle_timeout_minutes
integer  | nullÂ
required
The number of minutes of inactivity after which this codespace will be automatically stopped.
Example:
60
idle_timeout_notice
string  | nullÂ
optional
Text to show user when codespace idle timeout minutes has been overriden by an organization policy
last_used_at
string <date-time>
required
Last known time this codespace was started.
Example:
2011-01-26T19:01:12.000Z
location
enum<string>Â
required
The Azure region where this codespace is located.
Allowed values:
EastUsSouthEastAsiaWestEuropeWestUs2
Example:
WestUs2
machine
object (Codespace machine)  | nullÂ
required
A description of the machine powering a codespace.
cpus
integerÂ
required
How many cores are available to the codespace.
Example:
4
display_name
stringÂ
required
The display name of the machine includes cores, memory, and storage.
Example:
4 cores, 8 GB RAM, 64 GB storage
memory_in_bytes
integerÂ
required
How much memory is available to the codespace.
Example:
8589934592
name
stringÂ
required
The name of the machine.
Example:
standardLinux
operating_system
stringÂ
required
The operating system of the machine.
Example:
linux
prebuild_availability
enum<string>Â Â |Â enum<null>Â
required
Whether a prebuild is currently available when creating a codespace for this machine and repository. If a branch was not specified as a ref, the default branch will be assumed. Value will be "null" if prebuilds are not supported or prebuild availability could not be determined. Value will be "none" if no prebuild is available. Latest values "ready" and "in_progress" indicate the prebuild availability status.
Allowed values:
nonereadyin_progress
Example:
ready
storage_in_bytes
integerÂ
required
How much storage is available to the codespace.
Example:
68719476736
machines_url
string <uri>
required
API URL to access available alternate machine types for this codespace.
name
stringÂ
required
Automatically generated name of this codespace.
Example:
monalisa-octocat-hello-world-g4wpq6h95q
owner
object (Simple User)Â
required
A GitHub user.
pending_operation
boolean  | nullÂ
optional
Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it.
pending_operation_disabled_reason
string  | nullÂ
optional
Text to show user when codespace is disabled by a pending operation
prebuild
boolean  | nullÂ
required
Whether the codespace was created from a prebuild.
Example:
false
publish_url
string <uri> | nullÂ
optional
API URL to publish this codespace to a new repository.
pulls_url
string <uri> | nullÂ
required
API URL for the Pull Request associated with this codespace, if any.