The private key file was downloaded when you clicked "Generate a private key". It's typically named:
grainlify.private-key.pem- Or
grainlify-YYYY-MM-DD.private-key.pem
Location: Usually in your Downloads folder
Open terminal and run:
# Navigate to where you saved the .pem file
cd ~/Downloads # or wherever you saved it
# Base64 encode the file
base64 -i grainlify.private-key.pem
# Or if that doesn't work:
cat grainlify.private-key.pem | base64Copy the entire output - it will be a long string like:
LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVB...
(many more characters)
Add this to your .env file or deployment platform:
GITHUB_APP_PRIVATE_KEY=<paste-the-entire-base64-string-here>Important:
- ✅ Paste the ENTIRE base64 string (it's very long)
- ✅ No line breaks or spaces
- ✅ No quotes needed (unless your env system requires them)
After adding to environment variables and restarting your backend, check the logs. You should see:
- No errors about "private key" or "GITHUB_APP_PRIVATE_KEY"
- If there are errors, double-check the base64 encoding
Error: "invalid private key"
- Make sure you copied the ENTIRE base64 string
- No line breaks or extra spaces
- Try re-encoding:
base64 -i your-key.pem
Error: "private key not configured"
- Check environment variable name:
GITHUB_APP_PRIVATE_KEY - Restart your backend after adding the variable
- Verify the variable is loaded:
echo $GITHUB_APP_PRIVATE_KEY
Lost the private key?
- You'll need to generate a new one in GitHub App settings
- Delete the old one and generate a new private key
- Re-encode and update your environment variables
- ✅ Most common use case
- ✅ Local development
- ✅ Most cloud hosting (Railway, Heroku, etc.)
- ✅ If organizations installing your app don't have IP allow lists
⚠️ Organizations that install your app have IP allow lists enabled⚠️ Your backend is behind a specific firewall⚠️ Your hosting provider requires it
-
For Production Server:
- Find your server's public IP
- Add:
YOUR_IP/32(e.g.,203.0.113.1/32) - Description: "Production server"
-
For Cloud Hosting:
- Check your provider's documentation for IP ranges
- Railway: Usually not needed (they handle it)
- Heroku: Usually not needed
- AWS: Check your VPC/security group IPs
-
For Testing:
- You can skip this entirely
- Only add if you get specific errors about IP allow lists
Recommendation: Start without adding any IPs. Only add them if you encounter issues or if organizations specifically require it.