deployer icon indicating copy to clipboard operation
deployer copied to clipboard

SSH unsupported option "accept-new"

Open trsteel88 opened this issue 3 years ago • 5 comments

  • Deployer version: 7.0.0-rc.4
task deploy:release
task deploy:update_code
[prod]  error  in update_code.php on line 84:
[prod] run export GIT_TERMINAL_PROMPT='0' GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=accept-new'; cd ~/application/prod/.dep/repo && (/usr/local/cpanel/3rdparty/lib/path-bin/git remote update 2>&1)
[prod] Fetching origin
[prod] command-line line 0: unsupported option "accept-new".
[prod] fatal: Could not read from remote repository.
[prod] Please make sure you have the correct access rights
[prod] and the repository exists.
[prod] error: Could not fetch origin
[prod] exit code 1 (General error)
task deploy:failed

trsteel88 avatar Jan 18 '22 10:01 trsteel88

Ok, so it looks like you can get around this bug if you define git_ssh_command as "ssh".

set('git_ssh_command', 'ssh');

trsteel88 avatar Jan 27 '22 01:01 trsteel88

A note here that you'd think the answer would be "upgrade the version of openssh on your server" since the accept-new option was introduced in 7.6...

However this is going to be a common problem as AmazonLinux only officially supports openssh v7.4.

hailwood avatar Feb 02 '22 21:02 hailwood

This is bad :( accept-new is really helpful. Will write a doc.

antonmedv avatar Feb 03 '22 09:02 antonmedv

Same problem. I asked hosting to be transferred to another server with OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021

Sogl avatar Jul 26 '22 11:07 Sogl

@antonmedv Could this be mentioned somewhere clearly in the docs? I couldn't get around this issue until I searched the github issues and found the set('git_ssh_command', 'ssh'); solution above :(

jonnott avatar Sep 06 '22 14:09 jonnott

@antonmedv Issue may be closed. Or is there anything else I can help out with?

HereticPilgrim avatar Mar 02 '23 16:03 HereticPilgrim

Nice catch) it can be closed.

antonmedv avatar Mar 02 '23 16:03 antonmedv

Just wanted to leave a note here that adding git_ssh_command: "ssh" to my deploy.yaml file not only removed the command-line line 0: unsupported option "accept-new". message, but fixed my git read connection entirely. I've been struggling with fatal: Could not read from remote repository. for hours now. I had done everything else I could possibly do, including setting up SSH keys and known hosts, etc. I happen to be on a CPanel host that no doubt has outdated OpenSSH.

cr0ybot avatar Jul 09 '23 16:07 cr0ybot

Just wanted to leave a note here that adding git_ssh_command: "ssh" to my deploy.yaml file not only removed the command-line line 0: unsupported option "accept-new". message, but fixed my git read connection entirely. I've been struggling with fatal: Could not read from remote repository. for hours now. I had done everything else I could possibly do, including setting up SSH keys and known hosts, etc. I happen to be on a CPanel host that no doubt has outdated OpenSSH.

Im using ubuntu 22.04 with "OpenSSH_8.9p1 Ubuntu-3ubuntu0.4, OpenSSL 3.0.2", but still facing

Fetching origin
[staging] ERROR: Repository not found.
[staging] fatal: Could not read from remote repository.
[staging] Please make sure you have the correct access rights
[staging] and the repository exists.
staging] error: Could not fetch origin
[staging]  error  in update_code.php on line 101:
[staging] exit code 1 (General error)
ERROR: Task deploy:update_code failed!

But when I manually cd to the directory and run the git remote update 2>&1 it works, but not in deployer.

fd6130 avatar Oct 31 '23 13:10 fd6130

[staging] fatal: Could not read from remote repository. [staging] Please make sure you have the correct access rights

antonmedv avatar Oct 31 '23 15:10 antonmedv

[staging] fatal: Could not read from remote repository. [staging] Please make sure you have the correct access rights

Fun fact: deployer successfully cloned the repo (so not suppose to have "Could not read from remote repository" error), but it error when executing git remote update 2>&1 in update_code.php.

I can cd to the directory .dep/repo created by deployer and successfully run the command git remote update 2>&1 according to the deployer shell output -v without issue but not in deployer itself.

Deployer: fatal: Could not read from remote repository. When I cd to directory and run git command: git fetch successfully.

fd6130 avatar Nov 01 '23 03:11 fd6130

Ok, so it looks like you can get around this bug if you define git_ssh_command as "ssh".

set('git_ssh_command', 'ssh');

If using yaml , you can config it like below:

config:
  git_ssh_command: ssh

curder avatar Feb 21 '24 07:02 curder