To elaborate on my prior answer, there are a couple of reasons why it works on the terminal and not on GoCD.
Firstly, your terminal is interactive, so git can prompt you for credentials. This will not work on GoCD because it does not open an interactive session. Secondly, GoCD credentials are injected using a URL builder, setting the credentials as the userinfo segment (think http://user:[email protected]:port/path). [email protected]:sample.git likely won’t parse as a URL, so creds are not injected. Since there is no interactive session, auth fails. On Thu, Jun 3, 2021 at 2:35 AM Marques Lee <[email protected]> wrote: > This looks like an SSH connection string? > > The credentials fields works with URLs. So, if this is SSH, you have two > options. Choose one of: > > 1) Put the connection string in proper URL format with scheme/protocol, > host, optional port, path, eg ssh://xxx.xxx.xxx.xxx/path/to/sample.git and > specify creds > > 2) Leave the connect string as-is and use SSH key authentication. I’d > highly recommend this approach over the other > > On Thu, Jun 3, 2021 at 2:06 AM Sangeeta Saikia < > [email protected]> wrote: > >> I am trying to connect GoCD (version 21.2.0) to a git repo (version >> 2.25.1), and I have entered the password of the git user under the >> 'Advanced Settings' section. But I get Permission denied error as shown >> below: >> >> >> Error performing command: --- Command --- >> git ls-remote [email protected]:sample.git refs/heads/master >> --- Environment --- >> {} >> --- INPUT ---- >> >> >> --- EXIT CODE (128) --- >> --- STANDARD OUT --- >> >> --- STANDARD ERR --- >> STDERR: Permission denied, please try again. >> STDERR: Permission denied, please try again. >> STDERR: [email protected]: Permission denied (publickey,password). >> STDERR: fatal: Could not read from remote repository. >> STDERR: >> STDERR: Please make sure you have the correct access rights >> STDERR: and the repository exists. >> --- >> >> When I run the following command from terminal, I get the prompt to enter >> password and the command gets executed successfully: >> >> git ls-remote [email protected]:sample.git refs/heads/master >> >> What am I doing wrong? Please help. >> >> Thanks >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "go-cd" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/go-cd/36ff3680-fffe-406d-85b3-27d5e68b7a18n%40googlegroups.com >> <https://groups.google.com/d/msgid/go-cd/36ff3680-fffe-406d-85b3-27d5e68b7a18n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "go-cd" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAPKX9jboWsKdrKMrgdSbmKT8Dx3hpBeowzwzr2Y3O5dhstGsxg%40mail.gmail.com.
