g4c - Git for CodeSandbox
Summary
Aims to seamlessly support basic git
commands via a bash alias in CodeSandbox.
Commands we will support
Note: To bypass the bash alias and access the real git, use \git
Setup
First, npm i --save-dev g4c
. This will give you access to the g4c command.
Second, generate your ssh-keys with npx g4c keygen
Third, configure the CodeSandbox secret environment variables
- G4C_EMAIL
- eg:
12345-CrashOverride@users.noreply.gitlab.com
- G4C_REMOTE
- G4C_ED25519
- Your private key, with new lines replaced by $ signs
- G4C_RSA (alternatively)
Finally, add "predev": "npx g4c i || :"
under your package.json scripts. Replace prestart with predevelop, preserve or prestart if you do not have a "dev" script.
"install" scripts won't work as we need access to the secrets which are not available at install time, only at final runtime.