r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
686 stars 62 forks source link

`pak::pak()` hangs on VS Code Dev Container #633

Open eitsupi opened 6 months ago

eitsupi commented 6 months ago

Maybe same as r-hub/rhub#581

VS Code Dev Containers automatically registers the following gitconfig in the container, and pak::pak() always seems to hang. (I think it used to hang when installing packages on GitHub, but now it seems to hang reliably)

[user]
        email = xxxx@xxxx
        name = xxx
[init]
        defaultBranch = main
[core]
        editor = code --wait
        symlinks = true
[pull]
        rebase = false
[credential]
        helper = "!f() { /home/username/.vscode-server/bin/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/node /tmp/vscode-remote-containers-5ac35a23-84dd-4701-b9b3-42dfea138948.js git-credential-helper $*; }; f"

If the credential helper is an unexpected command, can we skip it so it doesn't run?

gaborcsardi commented 6 months ago

I guess we can have some heuristics to skip a credential helper.

But can you try to run it manually to see what happens? E.g. can you run this (or whatever is in the config)?

/home/username/.vscode-server/bin/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/node /tmp/vscode-remote-containers-5ac35a23-84dd-4701-b9b3-42dfea138948.js git-credential-helper

Also, can you run this from a shell?

git credential fill
url=https://github.com

You need to type in the second line after while git is waiting for input, and then press ENTER twice. Does that print your token?

eitsupi commented 6 months ago

But can you try to run it manually to see what happens? E.g. can you run this (or whatever is in the config)?

/home/username/.vscode-server/bin/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/node /tmp/vscode-remote-containers-5ac35a23-84dd-4701-b9b3-42dfea138948.js git-credential-helper

Also, can you run this from a shell?

git credential fill
url=https://github.com

You need to type in the second line after while git is waiting for input, and then press ENTER twice. Does that print your token?

In both cases it hangs and does not respond to anything.

In addition, I suspect that in my environment I usually communicates to GitHub over ssh using a key shared by ssh-agent, and that this script does nothing in effect.

If I ran the same container on a computer that did not have ssh-agent set up, I would have seen a screen prompting me to log in at GitHub using HTTPS.

eitsupi commented 6 months ago

Maybe this is helpful. https://github.com/microsoft/vscode-remote-release/issues/9466#issuecomment-1966296426