During the build process, it might be necessary to access other private repositories containing, for instance, libraries.
In case such repositories do not belong to the same user that can clone the main application codebase, it is possible to use git credentials codebase.
Then build an url for the Git Credentials.
The URL for github looks like:
while for bitbucket looks like:
username is the username of the account used to generate the token.
Finally add a secret inside an environment
with key called
GIT_CREDENTIALS and for the value use the url created before.
At this point, if you use this environment during a build, you can access your repository specifying the
clone url without any token.
For instance, if your private repo contains an npm library, the
package.json would reference it in this way: