Install WSL 2 with the default Ubuntu distribution in PowerShell:
wsl --installInstall Docker Desktop or using Chocolately in PowerShell:
choco install -y docker-desktopRight 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 vscodeInstall the Remote Development Extension Pack.
Install Git or using Chocolately in PowerShell:
choco install -y gitRestart 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/privateA 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 -yInstall Gpg4win or using Chocolately:
choco install -y gpg4winRestart PowerShell if Chocolately was used to install. In PowerShell, generate a new GPG key:
gpg --full-generate-keyThe 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? 5To get the key ID, use the following command:
gpg --list-secret-keys --keyid-format LONGOn the line with sec, the key ID is the hex string after rsa4096/. Export the public key:
gpg --armor --export KEYIDCopy 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 trueTo 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 -yAdditionally, the following line will need to be included in devcontainer.json:
"postStartCommand": "git config --global gpg.program \"$(which gpg)\""