SSH - Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

Hi All,
I am trying to connect the remote server from Gitlab CI, but when it tries to connect the server gets the below issue.
Please suggest, how to fix this type of error.

/usr/bin/ssh-agent
Agent pid 22
Identity added: /dev/fd/63 (jboss@xxxx-app0x.xxxx.com)
# xxxx-app0x.xxxx.com SSH-2.0-OpenSSH_7.4
# xxxx-app0x.xxxx.com SSH-2.0-OpenSSH_7.4
# xxxx-app0x.xxxx.com SSH-2.0-OpenSSH_7.4
Copying in Txxxx kxxx files...
Warning: Permanently added '[xxxxx](http://xxxx-app0x.xxxx.com),1xx.2xxx.1xx.xx' (ECDSA) to the list of known hosts.
  *******************************************************************************
  *                                                                             *
  *          Access to this password protected system is restricted             *
  *          to authorized users only.                                          *
  *                                                                             *
  *                                                                             *
  *          Unauthorized xxxxxxxxx                                     *
  *                                                                             *
  *                                                                             *
  *          xxxxxx                                     *
  *                                                                             *
  *******************************************************************************
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

The SSH configuration is as below in the CI pipeline.

      which ssh-agent 
      eval $(ssh-agent -s)
      ssh-add <(echo "$SSH_PRIVATE_KEY")  
      mkdir -p ~/.ssh
      chmod 700 ~/.ssh  

      ssh-keyscan xxx-xxxx-app01.xxx.com >> ~/.ssh/known_hosts
      chmod 644 ~/.ssh/known_hosts

      echo "Copying in Txxxx kxxx files..."
      scp -p22 -o StrictHostKeyChecking=no -r jboss@xxx-xxxx-app01.xxx.com:/repos/nxxxe/txxx/xxxxx*.json .

Thanks.

Hi,

I suggest to actually look in the target server logs why it was denied.

Hi @balonik,
Thank you for the response.
Which logs you’re referring to look into the target server, please.

if your are using a container u need to check the connectivity between server and container

Got it.
The issue has been resolved after placing the public key into the authorized keys.

Thanks.