我已經在ec2實例和我的本地機器上安裝了git。 安裝git後,我在ec2中使用了下面的命令。如何使用本地機器在ec2中配置git?
cd home/username/git
mkdir newproject.git
cd newproject.git
git init --bare
cd /var/www/html/projectname
git init
git add --all
git commit -m 」first commit」
git remote add origin [email protected](ec2):/home/username/newproject.git
下面是我在安裝git後執行的命令。
Cd /var/www/html/projectname
git init
git add --all
git commit -m 」first commit」
git remote add origin [email protected](EC2):/home/username/newproject.git
現在,當我從我的本地機器給下面的命令
git pull origin master
我收到以下錯誤。
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
然後從我的本地機器時,我給
git push origin master
我讓我提示以下錯誤:
ssh: Could not resolve hostname ip-181.177.2.11(EC2) Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
注:我通常登錄通過使用密鑰通過ssh到EC2。 pem文件。 有人指導我如何配置git從本地到ec2機器?
這是關於github或關於在您的服務器上設置git的問題? – Jakuje