Environment variables#
In all builds#
The following four environment variables should be set for git2cpp commit and git2cpp merge
subcommands. The use of git2cpp config instead is partially supported and will be improved in
time.
GIT_AUTHOR_EMAILThe email for the “author” field.
GIT_AUTHOR_NAMEThe human-readable name in the “author” field.
GIT_COMMITTER_EMAILThe email for the “committer” field.
GIT_COMMITTER_NAMEThe human-readable name for the “committer” field.
In WebAssembly build only#
GIT_CORS_PROXYIn-browser remote
git2cppoperations such asclone,fetchandpushusually require use of a CORS proxy server. Use this environment variable to specify how the target URL is encoded into the CORS proxy URL, details of which depend on how the CORS proxy server is implemented.The
GIT_CORS_PROXYshould contain the URL of the CORS proxy itself, followed by a number of substitutions which are denoted by curly braces. To illustrate the substitutions, assume that thegit2cppcommand is for the repository athttps://github.com/organisation/repository.Substitutions:
{host}is replaced bygithub.com{path}is replaced by/organisation/repository/followed by extra information that depends on details of thegit2cppoperation being performed{protocol}is replaced byhttps:{url}is equivalent to{protocol}//{host}{path}{api_key}is replaced by the value of environment variableGIT_CORS_PROXY_API_KEYif it is set.
If no substitutions are specified then
{url}is appended.All of the substitutions except
{api_key}have an:encodevariant such as{url:encode}that passes the argument through the encodeURIComponent JavaScript function, which some CORS proxies require.You can verify the actual URL used for requests in the Network tab of your browser’s Developer Tools for debugging purposes.
See CORS proxy server for usage examples.
GIT_CORS_PROXY_API_KEYThis value is used to replace the
{api_key}inGIT_CORS_PROXYand is intended for use with a CORS proxy that requires an API key. Alternatively the API key could be put directly in theGIT_CORS_PROXYinstead.
GIT_HTTP_TIMEOUTIn the WebAssembly build, all http(s) requests are limited by a timeout which has a default of 10 seconds. To use a different timeout set the
GIT_HTTP_TIMEOUTenvironment variable. For example, to set a timeout of 20 seconds use:export GIT_HTTP_TIMEOUT=20