Can not connect to jenkins using jenkins-cli

76 views
Skip to first unread message

Smahane EL BAZ

unread,
Dec 20, 2018, 9:59:59 AM12/20/18
to Jenkins Users
Hello ,

I can not connect to jenkins using these commands even if the option Enable CLI over Remoting is activated in Configure Global Security:


1-java -jar jenkins-cli.jar -s jenkinsUrl help

2-java -jar jenkins-cli.jar -http -auth myusername:mypassword -s JenkinsUrl get-job jobName > jobName.xml

3-java -jar jenkins-cli.jar -http -auth myusername:myApiToken-s JenkinsUrl get-job jobName > jobName.xml

4-java -jar jenkins-cli.jar -s JenkinsUrl -auth myusername:myApiToken get-job jobName > jobName.xml

5-java -jar jenkins-cli.jar -s JenkinsUrl -auth myusername:mypassword get-job jobName > jobName.xml


I had this error :

java.io.IOException: Server returned HTTP response code: 401 for URL: myJenkinsUrl/cli?remoting=false

        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)

        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)

        at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:101)

        at hudson.cli.CLI.plainHttpConnection(CLI.java:652)

        at hudson.cli.CLI._main(CLI.java:612)

        at hudson.cli.CLI.main(CLI.java:426)


Any help will be appreciated.


Thank you.

Reply all
Reply to author
Forward
0 new messages