Programming, error messages and sample code
How to deploy Node.js to our server through GitHub deploy key?
Programming, error messages and sample code > Node.js
A GitHub deploy key is an SSH key that grants access to a single repository. It is primarily used to automate the launching of projects from GitHub to your server, such as in production environments or CI/CD pipelines. This article will introduce how to deploy a Node.js application to our server using a GitHub deploy key.
1. Generate SSH key locally
- Open command prompt and run the command below:
ssh-keygen -t ed25519 -C "deploy-key-example"
- You will get 2 files in the default folder(C:\Users\xxx): test and test.pub(you can custom file name when generating it, 'test' is the private key needed to upload to our server, 'test.pub' is the public key needed to be uploaded to GitHub).
- Git Branch(optional, default branch is usually main or master)
- Github Repository URL(required)
- Deploy key(required)
- Select deploy key(required, choose the private key file(test) generated at step1)
- Passphrase (optional, needed only if your key has a passphrase):
- Build Command (optional, automatically detected if left blank for most frameworks)
- Start Command (optional, automatically detected if left blank)