GIT_SSH having no effect

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GIT_SSH having no effect

Robert Nicholson
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

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: GIT_SSH having no effect

Mark Waite-2
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?

On Fri, Mar 22, 2019 at 3:17 PM Robert Nicholson <[hidden email]> wrote:
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

--
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 [hidden email].
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHws1t_-ibbUS663RkVxcbNnQRT7ZFky0GVHMgMZ%2B_%3DHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: GIT_SSH having no effect

Robert Nicholson
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.

On Mar 22, 2019, at 4:53 PM, Mark Waite <[hidden email]> wrote:

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?

On Fri, Mar 22, 2019 at 3:17 PM Robert Nicholson <[hidden email]> wrote:
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

--
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 [hidden email].
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHws1t_-ibbUS663RkVxcbNnQRT7ZFky0GVHMgMZ%2B_%3DHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4C27DE3E-A4EE-4BEE-95AE-4CA40B28FE7F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.