Heroku Permission Denied Solution
在试图push
我的app到heroku时git push stage master
总是弹错,信息如下
Warning: Permanently added the RSA host key for IP address '50.19.85.154' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在Stackflow上找到了解答link
Kris Hollenbeck回答来自Heroku自己的文档 如果需要在heroku商用SSH Git的话,需要创建一对public/private key pair来不输代码。这对秘钥用来进行加密,辨识你为唯一的developer当你改动代码时。
SSH原理我没弄明白,操作如下:
生成一个public key
(venv) Zephyr (master) project $ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/Users/mac/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/mac/.ssh/id_rsa. Your public key has been saved in /Users/mac/.ssh/id_rsa.pub. The key fingerprint is: SHA256:/04ujrGjMmvmNXflaxcM9S9HSk6VGC66qLKmeGrWbX8 Zephyr@Zephyr The key's randomart image is: +---[RSA 2048]----+ | .o .| | .....| | . o o | | . o o o| | S. .* o.| | ...o * o| | . . o.o.o o + | |.o.+=+.o.E.+... | |=+o=*=oo+o.+=. | +----[SHA256]-----+
点击enter当提示输入时,采用默认位置
adding keys to heroku
Permission denied (publickey).
是非常常见的错误,需要通知heroku新的key(venv) Zephyr (master) project $ heroku keys:add Found an SSH public key at /Users/mac/.ssh/id_rsa.pub ? Would you like to upload it to Heroku? Yes Uploading /Users/mac/.ssh/id_rsa.pub SSH key... done
再运行
git push stage master
成功;结果略过
Change log
2017.02.25 Initial Draft