'gitlab oauth2 authentication in jenkins

I have configured a jenkins test job just to clone a git repo and provided the "Repository URL" like below

https://oauth2:[email protected]/test/batch/test.git

but while running the job I am getting the console error output as below

Cloning the remote Git repository
Cloning repository https://oauth2:[email protected]/test/batch/test.git
> git init /jenkins/jobs/test/workspace # timeout=10
Fetching upstream changes from https://[email protected]/test/batch/test.git
> git --version # timeout=10
Setting http proxy: 10.203.195.26:8080
> git fetch --tags --progress https://[email protected]/test/batch/test.git 
+refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'

The question is, while it is cloning it is showing the URL as https://oauth2:[email protected] but why the password is not coming while fetching?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source