Skip to content

create/edit/list/delete repo environment #5149

Description

@ignacio-valencia

Describe the feature or problem you’d like to solve

I need to create/edit/list/delete a repository environment

Proposed solution

gh repo create [repository] --env [environment]
or
gh env create [environment] --repo <[HOST/]OWNER/REPO

Additional context

this option setting
image

Activity

  1. added
    discussFeature changes that require discussion primarily among the GitHub CLI team
    extension-ideaAn idea that could make a good GitHub CLI extension
    and removed on Feb 1, 2022
  2. self-assigned this
    on Feb 2, 2022
  3. samcoe commented on Feb 3, 2022

    @samcoe
    Contributor

    @ignacio-valencia Thanks for the feature request. Overall I can see how this feature would add value but I am unsure of how much use it would get. For right I would suggest that this is a good feature to be added through an extension. I am going to leave this issue open and if other community members show interest in this feature we can come back and re-evaluate if it is worth adding it directly to gh.

  4. removed
    discussFeature changes that require discussion primarily among the GitHub CLI team
    on Feb 3, 2022
  5. removed their assignment
    on Feb 3, 2022
  6. ignacio-valencia commented on Feb 4, 2022

    @ignacio-valencia
    Author

    hello @samcoe if this functionality takes value away from the command

    # Set secret for a deployment environment in the current repository
    $ gh secret set MYSECRET --env myenvironment
    

    ref: https://cli.github.com/manual/gh_secret_set
    if I can work with environments in other gh commands it is illogical that I cannot create an environment with gh

    please help me!!

  7. DavidGamba commented on Feb 14, 2022

    @DavidGamba

    The github UI for a workflow lists the workflow runs and shows the environment as the text that is shown. However, using the cli you can't get the environment of the workflow run.
    Since that functionality doesn't exist in that way, I would like to list environments and then list workflow runs for a given environment.

  8. joosangkim commented on Mar 16, 2022

    @joosangkim

    I really need this enhancement to set my team's repositories. Github Actions doesn't support organization wide environments like CircleCI contexts or templating repository only create branches and source files not secrets and environments defined in the template. Thus I've been creating my own environment management method with gh cli. gh secret set -e MYENV command omit 404 error if there are no MYENV environment but I expected this command can create new environment if there is no environment named MYENV :(

  9. krisrecur commented on Apr 3, 2022

    @krisrecur

    I would like to see organization level environments that could be applied to multiple repos. In the absence of that, as others above have stated, tooling is needed to manage the environments across many repos.

    IMO, The static delay timer on environments is of minimal value in its current form. Setting an "allowed execution time window" would be useful.

  10. matthenry87 commented on Apr 16, 2022

    @matthenry87

    I am also looking for this feature. When we setup new repositories, part of the DevOps tasks includes creating the kube config secrets in each environment. This way workflows can only use the credentials in their workflow when the run has been approved, and nobody can arbitrarily switch credentials.

    Being able to create the environments would help completely automate this task.

  11. johnmckeever commented on Jul 7, 2022

    @johnmckeever

    We would also find this feature VERY valuable!

  12. 36 remaining items

  13. jtmcg commented on Feb 25, 2025

    @jtmcg
    Contributor

    We are breaking the work described in this comment into their own issues so that its easier for folks to contribute. The first of them is below. I'll continue to update this comment as the rest of the issues get written.

  14. Hamidsalri commented on Feb 26, 2025

    @Hamidsalri
  15. removed their assignment
    on Apr 23, 2025
  16. jparry-tds commented on Jan 9, 2026

    @jparry-tds

    When I try to create a secret in an environment that doesn't exist, it would be useful to optionally be able to create that environment at that point

    gh secret set SOME_SECRET --body $someBody --repo org/reponame --env $envName --createenv

    Or at least to have an option within the gh env create to not produce an error if the environment already exists, so that repos can have environments and secrets added in an idempotent way

  17. shbernal commented on Oct 10, 2026

    @shbernal

    Until this lands in core gh, I wrote an extension that covers it: shbernal/gh-envy.

    gh extension install shbernal/gh-envy
    gh envy create production --reviewer my-org/ops --wait-timer 30m --branch main --tag 'v*'
    gh envy list --json name,reviewers,waitTimer

    It does list, view, create, edit, delete and clone, including required reviewers, wait timer, branch and tag policies and custom protection apps. Flags, -R, prompts and --json/--jq/--template follow gh variable and gh secret, so it should be easy to port if the maintainers want any of it upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIextension-ideaAn idea that could make a good GitHub CLI extensiongh-reporelating to the gh repo commandgh-workflowrelating to the gh workflow commandpitchpitched internally for prioritisation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions