我是一个相对缺乏经验的开发人员,试图接管以前编码人员的网站的开发。
该代码存在于GitHub上的存储库上,该网站托管在Linux服务器上。我可以以非root用户的形式远程记录到服务器中,并运行 sudo git pull origin master
命令,但由于github的许可拒绝了错误,因此它无法正常工作。已经有一个〜/.ssh
带有 euthorized_keys
的目录, nown_hosts
以及 id_rsa
files。
我已经尝试将密钥添加到我的GitHub帐户中,并且还尝试使用新生成的密钥,但它不起作用,我什至不确定是否应该在我的帐户中添加这些密钥。我的帐户确实可以访问存储库,但是我不确定这是否是其工作方式。
谁能告诉我我需要做什么,以使我有可能将代码从GitHub存储库提取到此远程服务器?
I am a relatively inexperienced developer trying to take over the development of a website from the previous coders.
The code exists on a repository on Github and the website is hosted on a Linux server. I can log remotely into the server as a non-root user and run a sudo git pull origin master
command but it won't work because of a permission denied error from Github. There is already an ~/.ssh
directory with authorized_keys
, known_hosts
as well as id_rsa
files.
I've tried adding the keys there to my Github account and also tried using newly generated keys but it didn't work and I'm not even sure if adding these keys to my account is supposed to work. My account does have access to the repository, but I'm not sure if that is how it works.
Could anyone tell me what I need to do in order to make it possible for me to pull the code from the Github repository to this remote server?
发布评论
评论(1)
如果您使用sudo运行命令,则使用存储在
/root
的凭据。确保:
git Remote -V
在存储库文件夹中执行的命令([email  procected] :auser/asepository
)ssh ssh in < -code> ssh ssh in < -ssh a href =“/cdn-cgi/l/电子邮件保护” class =“ __ cf_email__” data-cfemail =“ 395E504D795E504D514C5B175A5654”>
您应该看到一个欢迎消息:
通常,如果您使用远程用户帐户而不是远程
root
帐户进行所有这些命令,那会更好。讨论,看来:
/home/company_name
/home/company_name/.ssh
需要需要修复< /a>What the OP had:
Versus the right permissions for SSH:
id_rsa
)(config
id_rsa.pub
)授权>
()nown_hosts
从那里,ssh -tv [email&nbsp; procected] 确实显示了预期的欢迎消息您已经成功验证了,但是GitHub不提供外壳访问。
任何
git clone/push/pull
都可以使用(再次,无需sudo
需要)If you run the command with sudo, you are using credentials stored in
/root
.Make sure that:
git remote -v
executed in the repository folder shows you an SSH URL ([email protected]:aUser/aRepository
)sudo ssh -Tv [email protected]
.You should see a welcome message like:
In general, it would be better if you do all those command with a remote user account instead of the remote
root
account.After discussion, it appears that:
/home/company_name
/home/company_name/.ssh
need to be fixedWhat the OP had:
Versus the right permissions for SSH:
id_rsa
) (code)config
id_rsa.pub
)authorized_keys
(code)known_hosts
From there, a ssh -Tv [email protected] does display the expected welcome message
Hi <You>! You've successfully authenticated, but GitHub does not provide shell access.
Any
git clone/push/pull
will work (again, nosudo
needed)