# 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
私はノードでこれを試しています(素晴らしいものにはcoffee
を使用しています)。しかし何らかの理由で、実行時にエラーが表示されます。Error: Command failed: conq: repository access denied. deployment key is not associated with the requested repository.
Node.jsにssh-keyを追加してクローンを作成することはできません
私が間違っていることがわかりません。これらのコマンドをコマンドラインから直接実行すると、すべて正常に動作しているようです。何か案は?
これを 'ssh'で直接再生してみましたか?gitを式から外しましたか? Bitbucketのサーバから何か有用なものは得られませんが(エラーメッセージから私が使用しているものと仮定します)、 "gitまたはhgを使用してBitbucketに接続できます。シェルアクセスは無効になっています。それが動作すれば;それがうまくいかない場合は、 'ssh -v'でデバッグを試みることができます。 –
もう一つの試みは、 'exec ssh -v" $ @ "'を実行するラッパーシェルスクリプトを作成し、gitが冗長モードでSSHを実行するように 'GIT_SSH'環境変数を設定することです。そうすれば、 'git'がSSHをどのように動かしているかを知ることができ、それはあなたにいくつかの手がかりを与えるかもしれません。 –