Closed tm-jdelapuente closed 1 month ago
Hmm, Visual Studio Code should be mounting your Git configuration from the host machine, but it might be a setting in Visual Studio Code that I'm missing documentation here on. Can you walk me through the exact steps you took including (if you're comfortable and feel free to sanitise) what your host machine's Git configuration looks like?
If this is a bug in template.py it'll be a documentation bug and not something we need in the devcontainer configuration. Let me know if that makes sense.
I followed the exact steps in the repo's readme (link) and didn't notice it until doing Git push.
I'm not sure if it's a config thing (if it is then it might be good to have a setup script that considers that when using the template?), but here's my VS Code config and gitignore.
VS Code config
{
"workbench.colorTheme": "Default Dark+",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"git.checkoutType": ["local"],
"editor.fontFamily": "Fira Code, FontAwesome, DroidSansMono Nerd Font",
"editor.fontLigatures": true,
"go.useLanguageServer": true,
"gopls": {
"directoryFilters": [...],
},
"go.toolsGopath": "[...]",
"go.gopath": "[...]",
"vs-wollemi.shell": "bash",
"vs-wollemi.wollemiCommand": "bash -c 'plz puku fmt \"$(echo \"$2/...\" | sed -e \"s|$(plz query reporoot)/|//|\")\"' --",
"terminal.integrated.allowChords": false,
"terminal.integrated.scrollback": 1e+92,
"terminal.integrated.persistentSessionScrollback": 10000,
"terminal.integrated.localEchoLatencyThreshold": -1,
"[python]": {
"editor.formatOnType": true
},
"python.analysis.extraPaths": [
"..."
],
"diffEditor.ignoreTrimWhitespace": false,
"plz.trace.server": "verbose",
}
Gitconfig
[user]
name = "..."
email = "..."
Happy to try to set a new repo up with the template and send a recording while doing so if it helps
After thinking a bit more, I'm wondering if this is due to Visual Studio Code not getting your git credentials due to a lack of SSH agent, but it's a tough one. Let me know if you find any more relevant information that would help understand what's happening here.
Could you also check with your github pull method set to SSH since GitHub is dropping support for their username and password authentication over HTTPS.
Tldr: I encountered the same problem with my personal laptop of my credentials being unavailable in the dev container. It's a Macbook Air 2019 (Intel) using HTTPS, as case above.
After cloning the repo and starting the dev container I got the same error with Vale:
Installing the current project: templatise (2.2.5)
/bin/sh: 1: vale: not found
[446870 ms] postCreateCommand failed with exit code 127. Skipping any further user-provided commands.
[446898 ms] Error: Command failed: /bin/sh -c poetry install && vale sync
[446899 ms] at N7 (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:235:130)
[446900 ms] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[446900 ms] at async Am (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:227:4393)
[446900 ms] at async Xw (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:227:3738)
[446901 ms] at async $w (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:227:2942)
[446902 ms] at async MrA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:661:32856)
[446902 ms] at async krA (/root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js:661:30074)
[446993 ms] Exit code 1
[446995 ms] Start: Run: docker rm -f f88891815abbd1b34b3e41d2487604cacaed2edc4f3bed70afc9e0efd0fd9804
[447011 ms] Command failed: node /root/.vscode-remote-containers/dist/dev-containers-cli-0.369.0/dist/spec-node/devContainersSpecCLI.js run-user-commands --container-session-data-folder /tmp/devcontainers-d16f1a97-c0be-4f8d-aea1-c6be5bc9d03b1718579528317 --workspace-folder /workspaces/symmetrical-waddle --id-label vsch.local.repository=https://github.com/14jdelap/symmetrical-waddle --id-label vsch.local.repository.volume=symmetrical-waddle-a657f478fc015c9af6c1177c20e2cecde2ac0ed5872d900236e95e815f9cf923 --id-label vsch.local.repository.folder=symmetrical-waddle --id-label devcontainer.config_file=/workspaces/symmetrical-waddle/.devcontainer/devcontainer.json --container-id 07a9a8c6674d6ae58381c775dbcd8cfc54a2dad4130fbe33ca1d3fa5a71dd1c0 --log-level debug --log-format json --config /workspaces/symmetrical-waddle/.devcontainer/devcontainer.json --override-config /tmp/devcontainer-464947ef-2c53-483e-a23b-ac7e6cd1c2ba.json --default-user-env-probe loginInteractiveShell --skip-non-blocking-commands false --prebuild false --stop-for-personalization true --remote-env REMOTE_CONTAINERS_IPC=/tmp/vscode-remote-containers-ipc-2151bfa1-3ef8-4738-807e-7120729db235.sock --remote-env SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-2151bfa1-3ef8-4738-807e-7120729db235.sock --remote-env REMOTE_CONTAINERS=true --mount-workspace-git-root --terminal-columns 121 --terminal-rows 26 --dotfiles-target-path ~/dotfiles
After running poetry run initialise
I restarted the container. I got the error Invalid author string. Must be in the format: John Smith <john@example.com>
because I didn't insert it when prompted to — maybe something to enforce if it's necessary/helpful?
I verified the same problem as with my work laptop: in the dev container my Git identity is unknown.
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'vscode@84a2d19df9a9.(none)')
Next step: I'm curious if this might be related to using HTTPS over SSH
When I cloned the repo using SSH my git config history is stored, and I'm able to commit and push.
I don't know why this is the case, but based on this behavior I'm fairly confident that that's the root cause. I'll make a pull request in the docs for that.
@tm-jdelapuente thanks for investigating this and finding the answer!
Closing this as the documentation in the README has been updated with more hints.
I used the template today as-is but found some frictions when using Git and pushing to GitHub
Is this a feature (security?) or a bug? If you agree that mounting the
.gitconfig
and.ssh
are a good idea I'm happy to send a a PR to add that indevcontainer.json
.