2017-08-05 54 views
0

我在試圖將代碼推送到運行ubuntu的ec2實例上的遠程git存儲庫的Windows機器上。我已經設置實例並在實例上的某個位置創建了一個裸回購。在Ubuntu服務器上推送到遠程git存儲庫 - 權限被拒絕(publickey)

我有我的公鑰在實例因爲我可以ssh通過膩子,也通過我安裝的openssh軟件。

我檢查了

https://serverfault.com/questions/39733/why-do-i-get-permission-denied-publickey-when-trying-to-ssh-from-local-ubunt

git push heroku master Permission denied (publickey)

Git - Permission denied (publickey)

,但建議的解決方案並不清楚,我

我可以使用SSH SSH連接實例-i的myKey .pem [email protected]

問題是我已經添加了回購我的遙控器的列表,但我不斷收到以下錯誤,當我試圖從我的本地主推使用遠程回購

production - ssh://[email protected] 

git push production master 

錯誤

Permission denied (publickey). 

fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 

and the repository exists. 

回答

0

I can ssh into the instance using ssh -i mykey.pem [email protected]

這是問題 - 您使用mykey.pem作爲ssh,但git使用默認密鑰。您必須配置ssh使mykey.pem是該主機的默認密鑰:

# .ssh/config 
Host ec2-1-1-1-1.compute-1.amazonaws.com 
    User ubuntu 
    IdentityFile mykey.pem 
+0

看來,在連接改變的東西,但想推的時候,我現在收到此錯誤 - 致命:協議錯誤:壞線長度字符:Agen 致命:遠端意外掛斷 –

相關問題