GIT_SSH having no effect

156 views
Skip to first unread message

Robert Nicholson

unread,
Mar 22, 2019, 5:17:42 PM3/22/19
to jenkins...@googlegroups.com
When I try to use

withCredentials(....)
withEnv(‘GIT_SSH=doesnotexist’])
sh ‘git push origin —tags’

For some reason the GIT_SSH seems to have no effect whatever.

The git push doesn’t complain that way I would have expected

But if I use

withEnv(‘PATH=‘])
sh ‘git push origin —tags’

That does have the intended affect of complaining about
Git not being found in the path.

Does anybody know why GIT_SSH nor GIT_SSH_COMMAND appear
not work with git 2.16.2 like I’m trying?

Sent from my iPad

Mark Waite

unread,
Mar 22, 2019, 5:53:35 PM3/22/19
to Jenkins Users
If the repository URL is http or https, I suspect that command line git ignores the values of GIT_SSH and GIT_SSH_COMMAND.

If the repository URL is http or https, why not use the solution provided at https://jenkins.io/doc/pipeline/examples/#push-git-repo (as noted by Ivan earlier)?

If the repository URL is ssh, why not use the sshagent step instead of using withCredentials?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0566D01A-779B-416F-86DF-CDEF500A64D5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Robert Nicholson

unread,
Mar 22, 2019, 7:08:43 PM3/22/19
to jenkins...@googlegroups.com
I guess my thinking was that this is when GIT_SSH and GIT_SSH_COMMAND are relevant.

Most of the online examples I’m finding seem to use this approach when the url is a https: one.

The other issue is it’s hard to trace what git is doing. I turned on GIT_TRACE and it seems to show
that it’s only running git and not the command I provided.

In my case the GitHub is a GitHub Enterprise installation.

Reply all
Reply to author
Forward
0 new messages