Skip to content

Provide non-admin mode from the Windows installer #1740

Open

Description

@cosmicle0

Hey there,

I'm trying to install github cli, but it seems like it needs admin privileges on windows. Is there a way to get a non-admin installer or a portable version?

Thanks!

Activity

  1. cosmicle0 commented on Sep 17, 2020

    @cosmicle0
    Author

    Sorry, I just found out that there's a zip release in the releases page. Thanks :)

  2. mislav commented on Sep 17, 2020

    @mislav
    Contributor

    Thanks for letting us know! In the future, we might try to allow a non-admin install.

    Protip: you can also install over package managers such as Chocolatey or Scoop 👍

  3. l3ender commented on Sep 18, 2020

    @l3ender

    It would be nice if the zip install were mentioned in the install notes and linked to from the download page. For those in an enterprise environment, admin privileges or package managers are usually not options.

  4. leonard84 commented on Oct 15, 2020

    @leonard84

    IMHO, the installer should ask whether to install for all users (admin) or only for current user (appdata local).

  5. mislav commented on Oct 16, 2020

    @mislav
    Contributor

    Thanks for the additional context; reopening this as a feature request to tweak the Windows installer. 👍

  6. reopened this on Oct 16, 2020
  7. changed the title [-]Non admin version[/-] [+]Provide non-admin mode from the Windows installer[/+] on Oct 16, 2020
  8. just1a-person commented on Dec 10, 2020

    @just1a-person
    Contributor

    IMHO, the installer should ask whether to install for all users (admin) or only for current user (appdata local).

    This shouldn't affect winget

  9. mislav commented on Dec 10, 2020

    @mislav
    Contributor

    @itsme-alan Could you elaborate?

  10. just1a-person commented on Dec 10, 2020

    @just1a-person
    Contributor

    @itsme-alan Could you elaborate?

    winget users expect a silent installation. Ideally there should be a command-line argument for the msi to specify installation for all users or for the current user.

  11. 4 remaining items

  12. cprima commented on Jan 15, 2022

    @cprima

    +1 for an easy way to get Git on the commandline in a restricted corporate environment. i.e. %APPDATA%.

    There are thousands of developers who only understand Git by using a "3rd party GUI interface". As a result they are lacking some fundamental understandings of how Git works. Git commands get LOCALIZED in these GUIs!?!

    With a solid way to install a CLI client one could start writing tutorials.

  13. JM-AlanSmith commented on Jan 31, 2022

    @JM-AlanSmith

    +1 for this too. Especially as the git-scm cli is there, as is Visual Studio Code and Python!

  14. mislav commented on Feb 2, 2022

    @mislav
    Contributor

    I've found some Wix documentation that sounds like it might address making a single MSI that covers both per-machine and per-user installation, but I have no experience with this. If someone wants to take a stab, our current Wix setup is here https://github.com/cli/cli/blob/trunk/build/windows/gh.wxs

  15. byjrack commented on Nov 28, 2023

    @byjrack

    Ironically came up again today and finally looked at the wix. Not only is it hard coded to Program Files which you can override with INSTALLDIR, but then it assumes it can write to HKLM so needs admin even if the install path isn't protected. May need to dust off my wix skills and see if I can make a control script that handles the User vs machine wide (+UI) and then still persist to the proper registry location.

  16. RobCannon commented on Jan 9, 2024

    @RobCannon

    It would be great if this could be fixed since the default way most Windows users are going to install this is via winget.

  17. RYRY1002 commented on May 3, 2024

    @RYRY1002

    +1 also.

    Downloading the .zip, extracting it and putting it in a folder with PATH access is a pain as opposed to typing in a command in winget. This is especially frustrating considering that the .zip essentially contains a single file, gh.exe.

  18. Syntex9000 commented on Aug 12, 2024

    @Syntex9000

    Would love to see this fixed. We work in restricted environments all the time and having the option to install on a user-level is a necessity.

  19. totkeks commented on Mar 7, 2025

    @totkeks

    Would be nice to support that using winget / installer.

  20. KirkMunroSagent commented on Jun 11, 2025

    @KirkMunroSagent

    I'm surprised this issue takes so long to fix. Anyway, I just threw together a PowerShell function to install the latest amd64 gh.exe binary for the current user without requiring elevation. Seems to work pretty well, so I thought I'd share it with others in case they want to give it a go. Here's the function, you should just be able to drop it into your profile script and then use it to install or update, as long as they don't change the way they're posting these too much.

    function Install-GitHubCli {
        # Create .gh folder if it doesn't exist
        $userProfileFolder = [Environment]::GetFolderPath('UserProfile')
        $ghFolder = Join-Path -Path $userProfileFolder -ChildPath '.gh'
        if (-not (Test-Path -LiteralPath $ghFolder)) {
            New-Item -Path $ghFolder -ItemType Directory > $null
        }
    
        # Get the main releases page HTML
        $releasesUrl = 'https://github.com/cli/cli/releases'
        $releasesHtml = Invoke-WebRequest -Uri $releasesUrl -UseBasicParsing
    
        # Identify the latest version using the first release link
        if ($releasesHtml.Content -notmatch '/cli/cli/releases/tag/(?<Version>[^"]+)') {
            Write-Error -Message 'No release link found.'
            return
        }
    
        $version = $matches['Version']
    
        # Download the zip file
        $downloadUrl = "https://github.com/cli/cli/releases/download/${version}/gh_$($version -replace '^v')_windows_amd64.zip"
        $zipFileName = "gh_${version}_windows_amd64.zip"
        $zipPath = Join-Path -Path $env:TEMP -ChildPath $zipFileName
        Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath
    
        # Extract gh.exe using Expand-Archive
        Expand-Archive -LiteralPath $zipPath -DestinationPath $ghFolder -Force
    
        # Clean up
        Remove-Item -LiteralPath $zipPath
    
        # Add to environment PATH for the current process and future processes via a user environment setting update if the path is not already present
        $currentPath = [Environment]::GetEnvironmentVariable('Path', [EnvironmentVariableTarget]::Process)
        $ghExeFolder = Join-Path -Path $ghFolder -ChildPath 'bin'
        if ($currentPath.Split(';') -notcontains $ghExeFolder) {
            ${env:Path} = "${currentPath};${ghExeFolder}"
            [Environment]::SetEnvironmentVariable('Path', ${env:Path}, [EnvironmentVariableTarget]::Process)
            [Environment]::SetEnvironmentVariable('Path', ${env:Path}, [EnvironmentVariableTarget]::User)
        }
    
        Write-Output "gh.exe installed to ${ghFolder} and ${ghExeFolder} added to PATH."
    }
  21. added
    coreThis issue is not accepting PRs from outside contributors
    and removed on Jul 25, 2025
  22. robert-plagge-usps commented on Jul 27, 2026

    @robert-plagge-usps

    Following up on this. While @KirkMunroSagent provided a nice reply, it'll be nice to have this built-in.

    Has there been any progress on this feature request?

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

    coreThis issue is not accepting PRs from outside contributorsenhancementa request to improve CLIpackagingwindowsRelated to Windows hosts or runners

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions