Not able to connect to private git repo using password

Skip to first unread message

Sangeeta Saikia

Jun 3, 2021, 5:06:41 AMJun 3
to go-cd

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 refs/heads/master
--- Environment ---
--- INPUT ----

--- EXIT CODE (128) ---

STDERR: Permission denied, please try again.
STDERR: Permission denied, please try again.
STDERR: Permission denied (publickey,password).
STDERR: fatal: Could not read from remote repository.
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 refs/heads/master

What am I doing wrong? Please help.


Marques Lee

Jun 3, 2021, 5:35:46 AMJun 3
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:// and specify creds

2) Leave the connect string as-is and use SSH key authentication. I’d highly recommend this approach over the other

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
To view this discussion on the web visit

Marques Lee

Jun 3, 2021, 5:40:43 AMJun 3
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:pa...@host.tld:port/path). likely won’t parse as a URL, so creds are not injected. Since there is no interactive session, auth fails.

Aravind SV

Jun 3, 2021, 5:52:50 AMJun 3
to Marques Lee,

I think the ssh:// protocol doesn’t work with username:password. So, I agree that option 2 (using SSH keys) is the right one to use.

Sangeeta Saikia

Jun 3, 2021, 6:04:15 AMJun 3
to go-cd
With the first approach, I get the same permission denied error. (This approach was preferred because we have some limitations in our system, and are not allowed to use public keys)

With the second approach, connection is successful.

Thank you all for the help.

Marques Lee

Jun 3, 2021, 6:18:03 AMJun 3
to Aravind SV,
Fair enough :). I’ve never tried it myself.

: Tyshawn: Despenza.

Aug 23, 2021, 9:13:05 PMAug 23
to go-cd
I'm having the same issue. I tried both methods and neither worked for me. It was working fine until today using HTTPS.

--- EXIT CODE (128) ---
STDERR: remote: HTTP Basic: Access denied
STDERR: fatal: Authentication failed for 

Any help would be appreciated. I'm running the latest using docker.

Reply all
Reply to author
0 new messages