Get Git repo URL being used in GitLab CI build

The GitLab docs on build env settings give the example that CI_BUILD_REPO has the Git repo CI is building from. From

Example values:

export CI_BUILD_BEFORE_SHA="9df57456fa9de2a6d335ca5edf9750ed812b9df0"
export CI_BUILD_REPO=""

But this may be a case where the docs are trailing the code. As in fact it gives the URL CI uses to fetch the code with tokens. Example:

export CI_BUILD_REPO=""

Here are a couple of Bash commands that can be used to get the actual URI:

# remove beginning upto @  
# remove path to actual project at end
echo repo = $BUILD_REPO

repo =

Now one has the URL that can be used to pull other Git projects into the build and it is not hard coded in the .gitlab-ci.yml file so one’s build code will work in both the production build env and the CI development env.