我有个云服务器,已经在上面安装 git,并按着网络方法搭建了git服务器。
现在的问题是,我在自己的电脑上,安装 msysGit , 提交代码,需要输入git的密码。(第一次不知道密码,后来我在云服务器上更改了git 的密码), 输入正确密码后能正常的登录和使用git。
我在云服务器上 root 用户 连接 git@localhost 也是一样的必须输入密码才能git push pull等功能。
我在 本地windows电脑 和 云服务器root用户 上 能正常连接github.com推拉代码。
所以,感觉还是 git@云服务器 设置有问题。
下面两个图片,都是用远端服务器root账户向该服务器上的git服务器的情况:
图1是登录需要密码
图2是/home/git/.ssh/authorized_keys 的权限
请大家具体指导一下!
更新:
最后参考本站的一个帖子解决了问题,有需要可以参考。
/q/1010000000691963
谢谢回答问题的几位。多谢多谢!!!
某草草2017-05-02 09:22:32
$ git config --global user.name "your name"
$ git config --global user.name "your name"$ git config --global user.email "your_email@youremail.com"
(4) Enter the warehouse to be uploaded, right-click git bash, and add the remote address:
$ git remote add origin git@github.com:yourName/yourRepo.git
After entering the password once, you don’t need to enter it again, it will be automatically saved
PHP中文网2017-05-02 09:22:32
Not as troublesome as upstairs
Create a file, name it _netrc for windows, .netrc for linux or mac
machine git.abc1.com
login username
password password
machine git.abc2.com
login username
password password
username is your username, password is your password,
machine is your git website domain name.
Multiple can be added.
Then put this file in your personal directory,
Windows is in the C:UsersXXXXXX directory,
linux or mac under ~/
曾经蜡笔没有小新2017-05-02 09:22:32
Command:
ssh-copy-id key public id code server address
For example:
ssh-copy-id -i ~/.ssh/id_rsa.pub code@192.168.0.6
Note:
The premise is that the key has been generated. The command to generate the key:
ssh-keygen -t rsa -C email address
For example:
ssh-keygen -t rsa -C "lisi@public.cn"
黄舟2017-05-02 09:22:32
Finally, the problem was solved by referring to a post on this site. You can refer to it if necessary.
/q/1010000000691963
阿神2017-05-02 09:22:32
Find authorized_keys on your git server
[*@### /]# find / -name authorized_keys
/home/git/.ssh/authorized_keys
Edit authorized - keys will be id_rsa in your git client. Copy the content in pub to the end
[*@### /]# vim /home/git/.ssh/authorized_keys
Save it to take effect
PHPz2017-05-02 09:22:32
You can refer to the article http://www.ctrlqun.com/linux_... for more details