V
V
Vladislav2020-07-21 15:39:06
linux
Vladislav, 2020-07-21 15:39:06

Permission denied (publickey,password). How to fix?

There is this gitlab-ci:

before_script:
  - apt-get update -qq
  - apt-get install -qq git
  - 'which ssh-agent || ( apt-get install -qq openssh-client )'
  - eval $(ssh-agent -s)
  - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
  - mkdir -p ~/.ssh
  - git rm --cached .gitlab-ci.yml
  - ' && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

deploy_staging:
  type: deploy
  environment:
    name: staging
    url: server 
  script:
    - ssh -A [email protected] -p 22 "cd www/site.ru && git checkout master && git pull origin master && composer install && exit"
  only:
    - master


Generated SSH:
Private key added to the variables in the repository and named: SSH_PRIVATE_KEY
Public added to the gitlab account settings.
done on the server
git init
git remote add origin <ссылка для клона по SSH>
git add .
git commit -m "init"
git push

all is well, everything went well.
checked the pull command
git pull origin master

Changes from the git were successfully received.
But on the git itself, the Job fails with an error at this point:
$ ssh -A [email protected] 22 "cd www/site.ru && git checkout master && git pull origin master && composer install && exit"
Warning: Permanently added 'server' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
[email protected]: Permission denied (publickey,password).
ERROR: Job failed: exit code 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RazdoR, 2020-07-22
@RazdoR

You can try ssh -o StrictHostKeyChecking=no and add the key to authorized_keys via ssh-copy-id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question