Authentication fails in git resource when private key is empty and git protocol is https


#1

Actually I am using a https protocol with basic authentication in the git resource.As my protocol is https
it shouldnot check the private_key entry. As my private_key entry is empty string it fails.
any idea how to fix this issue ?
resources:

  • name: abc
    type: git
    check_every: 5m
    source:
    uri: https://abc.git
    username: abc
    password: abc
    skip_ssl_verification: true
    branch: master
    private_key: “”

resource script ‘/opt/resource/check []’ failed: exit status 1
stderr:
Error loading key “/tmp/git-resource-private-key”: invalid format

Error loading key “/tmp/git-resource-private-key”: invalid format


#2

Did you try removing private_key: entirely? An empty string would not be valid under any circumstances.


#3

@hstenzel It will work if we remove private key … but it should work even if private key entry present … actually this entry for me is null (private_key): “null”). How to get rid of double quotes for null … ???


#4

I mentioned this in Discord too, but if using https you should not specify private_key at all (even null). Only if using ssh type (git://)

From concourse/git-resource docs:

username : Optional. Username for HTTP(S) auth when pulling/pushing. This is needed when only HTTP/HTTPS protocol for git is available (which does not support private key auth) and auth is required.


#5

@eedwards-sk I have made that working even if private key entry is present . Thanks :slight_smile: