Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bucket add fails behind proxy #1615

Closed
edmulraney opened this issue Jul 20, 2017 · 7 comments · Fixed by #5122 or #5424
Closed

bucket add fails behind proxy #1615

edmulraney opened this issue Jul 20, 2017 · 7 comments · Fixed by #5122 or #5424
Labels

Comments

@edmulraney
Copy link

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
Copy link
Author

Know any work arounds?

@lukesampson
Copy link
Member

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.

@gitolicious
Copy link
Contributor

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.

@igitur
Copy link
Contributor

igitur commented Sep 28, 2020

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.

@brunnels
Copy link

brunnels commented May 4, 2021

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
Copy link

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
}

@rashil2000
Copy link
Member

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 currentuser@proxy.example.org: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 currentuser@proxy.example.org: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 'currentuser@proxy.example.org: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 'currentuser@proxy.example.org:8080'
scoop install vscode # 'install' works now

r15ch13 added a commit to r15ch13/scoop that referenced this issue Nov 12, 2022
- By using direct path to ~\scoop\apps\git\current\mingw64\bin\git.exe this prevents spawning subprocesses and improves execution time
- Fixes ScoopInstaller#1615 by replacing currentuser@ with :@
- Spawns cmd.exe only if proxy is set and required by the git command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants