mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-30 23:30:09 +08:00 
			
		
		
		
	Use custom port for host scan
This commit is contained in:
		
							parent
							
								
									164a3e861e
								
							
						
					
					
						commit
						a1e01b2fad
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1979
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1979
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -20,7 +20,7 @@ const run = async () => { | ||||
|   const { path: privateKeyPath } = getPrivateKeyPath(deployKeyName); | ||||
|   // Update known hosts if ssh command is present to avoid prompt
 | ||||
|   if (scriptBefore || scriptAfter) { | ||||
|     updateKnownHosts(remoteHost); | ||||
|     updateKnownHosts(remoteHost, remotePort); | ||||
|   } | ||||
|   // Check Script before
 | ||||
|   if (scriptBefore) { | ||||
|  | ||||
| @ -23,11 +23,11 @@ const addSshKey = (content, deployKeyName) => { | ||||
|   console.log('✅ [SSH] key added to `.ssh` dir ', dir, filename); | ||||
| }; | ||||
| 
 | ||||
| const updateKnownHosts = (host) => { | ||||
| const updateKnownHosts = (host, remotePort) => { | ||||
|   const { knownHostsPath } = getPrivateKeyPath(); | ||||
|   console.log('[SSH] Adding host to `known_hosts` ....', host, knownHostsPath); | ||||
|   try { | ||||
|     execSync(`ssh-keyscan -H ${host}  >> ${knownHostsPath}`, { | ||||
|     execSync(`ssh-keyscan -p ${(remotePort || 22)} -H ${host}  >> ${knownHostsPath}`, { | ||||
|       stdio: 'inherit' | ||||
|     }); | ||||
|   } catch (error) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Sebastian Blesgen
						Sebastian Blesgen