git提交到自己的服务器,每次都要输入密码
黄舟
黄舟 2017-05-02 09:20:32
0
9
947

我有个云服务器,已经在上面安装 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

谢谢回答问题的几位。多谢多谢!!!

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(9)
某草草

2 methods:

  • ssh Then the url must be connected using a similar ssh connection: git@192.168.0.200:weitoo/server-aggregator.git Since you have configured sshkey, the url must use the ssh protocol
  • url

$ 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

Ty80

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 ~/

曾经蜡笔没有小新

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"

过去多啦不再A梦

You enter your password when doing local git init

習慣沉默

Just use ssh. key

滿天的星座

Hello, I also encountered your problem, have you solved it

黄舟

Finally, the problem was solved by referring to a post on this site. You can refer to it if necessary.
/q/1010000000691963

阿神

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

PHPzhong

You can refer to the article http://www.ctrlqun.com/linux_... for more details

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template