我已经在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