Install WSL 2 with the default Ubuntu distribution in PowerShell:
wsl --install
Install Docker Desktop or using Chocolately in PowerShell:
choco install -y docker-desktop
Right click on the Docker icon in the taskbar and select Settings
. In General
, ensure that Use the WSL 2 based engine
is checked.
Install Visual Studio Code or using Chocolately in PowerShell:
choco install -y vscode
Install the Remote Development Extension Pack.
Install Git or using Chocolately in PowerShell:
choco install -y git
Restart PowerShell if Chocolately was used to install. In PowerShell, set the credential manager, then try an action that requires authentication, such as cloning one of your private repositories:
git config --global credential.helper
git clone https://github.com/sears-s/private
A prompt should appear asking for your GitHub credentials. After logging in, click Sign in with your browser
. In the browser, click Authorize GitCredentialManager
. Future actions won't require your GitHub credentials again.
Set your name and email address in PowerShell (replace with your own):
git config --global user.name "Sears Schulz"
git config --global user.email "[email protected]"
You can find your private GitHub email address here.
To use Git within devcontainers, the git
package must be installed. This can be done within the Dockerfile:
RUN apt-get update && apt-get install git -y
Install Gpg4win or using Chocolately:
choco install -y gpg4win
Restart PowerShell if Chocolately was used to install. In PowerShell, generate a new GPG key:
gpg --full-generate-key
The kind of key should be RSA and RSA
(default) and the key size should be 4096
. The email address must be the same as your GitHub private email address. Alternatively, a key can be imported:
gpg --export-secret-keys -a KEYID > my-key.asc
gpg --import my-key.asc
gpg --edit-key KEYID
gpg> trust
Your decision? 5
To get the key ID, use the following command:
gpg --list-secret-keys --keyid-format LONG
On the line with sec
, the key ID is the hex string after rsa4096/
. Export the public key:
gpg --armor --export KEYID
Copy the output, from -----BEGIN PGP PUBLIC KEY BLOCK-----
to -----END PGP PUBLIC KEY BLOCK-----
, inclusive. Back on GitHub, paste this, then click Add GPG key
.
In PowerShell, enable Git GPG signing:
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
git config --global user.signingkey KEYID
git config --global commit.gpgsign true
To sign commits within devcontainers, the gnupg2
package must be installed. This can be done within the Dockerfile:
RUN apt-get update && apt-get install gnupg2 -y
Additionally, the following line will need to be included in devcontainer.json
:
"postStartCommand": "git config --global gpg.program \"$(which gpg)\""