Merge pull request #4 from JulianGro/ssh_mkdir

Create directory if needed
This commit is contained in:
wl
2020-07-05 15:43:27 +08:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -58,7 +58,7 @@ args of sftp cmd, E.g.`-o ConnectTimeout=5`
server: 'your server ip'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
local_path: './static/*'
remote_path: '/var/www/app' #make sure dir exist
remote_path: '/var/www/app'
args: '-o ConnectTimeout=5'
## 1. [Deploy React App Example](https://github.com/wlixcc/React-Deploy)

View File

@@ -12,8 +12,11 @@ printf "%s" "$4" >$TEMP_SSH_PRIVATE_KEY_FILE
# avoid Permissions too open
chmod 600 $TEMP_SSH_PRIVATE_KEY_FILE
echo 'sftp start'
echo 'ssh start'
# create directory if needed
ssh -o StrictHostKeyChecking=no -i $TEMP_SSH_PRIVATE_KEY_FILE $1@$2 mkdir -p $5
echo 'sftp start'
# create a temporary file containing sftp commands
printf "%s" "put -r $5 $6" >$TEMP_SFTP_FILE
#-o StrictHostKeyChecking=no avoid Host key verification failed.