2 months ago
I'm deploying a Swift/Vapor app on Railway with a Dockerfile. The build fails when resolving a private GitHub dependency (my repo) because it can't authenticate.
Error:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
I've added GIT_ACCESS_TOKEN as a Railway variable with a GitHub PAT (repo scope) and configured git credentials in my Dockerfile before swift package resolve, but SPM still fails to authenticate.
Is there a recommended way to configure private GitHub package dependencies in Railway builds?
1 Replies
2 months ago
Are you passing the environment variable into your docker file as an ARG?
https://docs.railway.com/guides/dockerfiles#using-variables-at-build-time
Environment variables are not automatically available during the Docker build process unless explicitly declared.
# Add this before you need to use the token
ARG GIT_ACCESS_TOKEN
# setup git to use the token as you do on your local machine
# run your build command