git のツールを go lang で作成していたのですが
git clone のコマンド時に下記エラーが発生しました
cmd := exec.Command("git", "clone", "--quiet", repo, path)
ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. panic: exit status 128
見た感じ go 側から ssh の鍵が参照できてない模様
調べたところ GIT_SSH_COMMAND
の環境変数をセットすれば問題なさそう
なので、git コマンドを実行する前に 環境変数をセットする処理を記述
os.Setenv("GIT_SSH_COMMAND", "ssh -i ~/.ssh/id_rsa")
これで鍵の追加ができリポジトリにアクセスできるようになった