search

Home  >  Q&A  >  body text

git提交到自己的服务器,每次都要输入密码

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

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

黄舟黄舟2767 days ago958

reply all(9)I'll reply

  • 某草草

    某草草2017-05-02 09:22:32

    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

    reply
    0
  • PHP中文网

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

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新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"

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-02 09:22:32

    You enter your password when doing local git init

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-02 09:22:32

    Just use ssh. key

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-02 09:22:32

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

    reply
    0
  • 黄舟

    黄舟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

    reply
    0
  • 阿神

    阿神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

    reply
    0
  • PHPz

    PHPz2017-05-02 09:22:32

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

    reply
    0
  • Cancelreply