Reputation: 85
I am taking git repository,username and password as input from user and am creating a jenkins job using the below config.xml
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
**<url>"git repository path"</url>**
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
</scm>
I don't know the syntax for sending username and password in xml. Where should I add username and password in xml
Upvotes: 2
Views: 1330
Reputation: 464
I didn't know but there is an easy way to give username and password. I explicitly gave username and password separated by a colon before @ in the url.
https://username:password@bitbucket.org/username/my_jenkins.git
Please refer to below code:
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://username:[email protected]/username/my_jenkins.git</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
Upvotes: 0
Reputation: 8670
Jenkins uses encryption for the password it stores so you'll need to encrypt your password. Because you didn't specify your Jenkins Master version or which Git SCM plugin version you're using, the safest way to see the format of the configuration is to do as suggested in your question's comments and create a dummy job that uses Git, and see how to create that section inthe job.
Good luck!
Upvotes: 1