Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

bucket add fails behind proxy

Open edmulraney opened this issue 6 years ago • 7 comments

Successfully installed scoop and after settings proxy (scoop config proxy currentuser@default) was able to scoop install however scoop bucket add extras fails with following error

Checking repo... 'https://github.com/lukesampson/scoop-extras.git' doesn't look like a valid git repository

Error given:
fatal: unable to access 'https://github.com/lukesampson/scoop-extras.git/': Couldn't resolve proxy 'default'

edmulraney avatar Jul 20 '17 16:07 edmulraney

Know any work arounds?

edmulraney avatar Jul 21 '17 15:07 edmulraney

As a workaround, try including the manual proxy configuration, rather than the currentuser@default shortcut.

Either scoop config proxy host:port or, if username/password are required then scoop config proxy username:password@host:port.

lukesampson avatar Jul 21 '17 23:07 lukesampson

The problem lies with this line: https://github.com/lukesampson/scoop/blob/master/lib/git.ps1#L5 currentuser@default is directly propagated to the environment variable used by git, though it should be checked like it is done in https://github.com/lukesampson/scoop/blob/master/lib/config.ps1#L78 and handled accordingly.

gitolicious avatar Nov 02 '17 21:11 gitolicious

Same issue here.

C:\>scoop config proxy default
'proxy' has been set to 'default'
C:\>scoop update
Updating Scoop...
fatal: unable to access 'https://github.com/lukesampson/scoop/': Could not resolve proxy: default
Update failed.

I connect and disconnect to my company VPN many times a day. The VPN automatically sets my system proxy to the company's proxy. Therefore I don't want to have to configure scoop's proxy manually, as I would have to set and remove that every time too. I'd like to use default all the time in order to resolve the currently configured system proxy.

igitur avatar Sep 28 '20 08:09 igitur

I have the same issue. Manual workaround is before I do scoop update or scoop bucket operations I do scoop config rm proxy. Then my git config --global http.proxy will handle the git updates that those commands are doing. Then if I want to install something or do scoop update * then I use scoop config proxy http://... to set the proxy again.

brunnels avatar May 04 '21 12:05 brunnels

Something simple like adding another config option works for me:

function git_proxy_cmd {
    $proxy = get_config 'proxy'
    $no_git_proxy = get_config 'no_git_proxy'
    $cmd = "git $($args | ForEach-Object { "$_ " })"
    if(!$no_git_proxy -and $proxy -and $proxy -ne 'none') {
        $cmd = "SET HTTPS_PROXY=$proxy&&SET HTTP_PROXY=$proxy&&$cmd"
    }
    & "$env:COMSPEC" /d /c $cmd
}

brunnels avatar May 28 '21 12:05 brunnels

From @taro-ball in #4086:

I've found the following issue when using scoop behind proxy that requires NTLM authentication:

If you try to run scoop config proxy [email protected]:8080 and then scoop bucket add extras it won't work because scoop passes these credentials directly to git and git has a different proxy format. So for "bucket add" to work you will have to change the proxy string to the format git understands so [email protected]:8080 becomes :@proxy.example.org:8080

# 'add' wont work with standard scoop proxy setup as discribed in https://github.com/lukesampson/scoop/wiki/Using-Scoop-behind-a-proxy :
scoop config proxy '[email protected]:8080'
scoop bucket add extras #this fails
# lets change to git proxy format:
scoop config proxy ':@proxy.example.org:8080'
scoop bucket add extras # now 'add' works
# but 'install' won't work, because proxy is still in git format
scoop install vscode # this fails
# now we change back to scoop format
scoop config proxy '[email protected]:8080'
scoop install vscode # 'install' works now

rashil2000 avatar Jan 17 '22 09:01 rashil2000