# Write the SSH-KEY to the disk
fs.writeFile "/cgrepos/.ssh/#{repo.id}.pub", repo.public_key, (err) ->
throw err if err
fs.writeFile "/cgrepos/.ssh/#{repo.id}", repo.private_key, (err) ->
throw err if err
exec "chmod 400 /cgrepos/.ssh/#{repo.id} && eval `ssh-agent -s` && ssh-add /cgrepos/.ssh/#{repo.id}", (error) ->
throw error if error
# First, delete the git repo on the hard drive, if it exists
exec "rm -rf #{git_location}", options, (error) ->
throw error if error
# Second, clone the repo into the location
console.log "Cloning repo #{repo.id}: #{repo.repo_name} into #{git_location}. This could take a minute"
exec "git clone #{repo.url} #{git_location}", options, (error) ->
throw error if error
Lo sto provando nel nodo (usando coffee
per quelli che sono fantastici). Ma per qualche ragione, quando funziona, mi dà un errore: Error: Command failed: conq: repository access denied. deployment key is not associated with the requested repository.
Non posso clonare clonando ssh-key in Node.js
Non so cosa sto facendo male. Se eseguo direttamente questi comandi dalla riga di comando, tutto sembra funzionare correttamente. Qualche idea?
Avete provato a riprodurlo direttamente con 'ssh', eliminando l'equazione? Anche se è improbabile che tu possa ottenere qualcosa di utile dal server di Bitbucket (dal messaggio di errore presumo che sia quello che stai usando) dovresti vedere "Puoi usare git o hg per connetterti a Bitbucket. L'accesso alla shell è disabilitato." se funziona; puoi provare 'ssh -v' per eseguire il debug se questo non funziona. –
Un'altra cosa che potresti provare è creare uno script di shell wrapper che esegua 'exec ssh -v" $ @ "' e imposta la variabile di ambiente 'GIT_SSH' in modo che git esegua SSH in modalità dettagliata. Quindi puoi vedere come 'git' sta eseguendo SSH e questo potrebbe darti qualche indizio. –