• 请不要在回答技术问题时复制粘贴 AI 生成的内容
clydelin
V2EX  ›  程序员

Git密码怎么保存的?

  •  
  •   clydelin · Sep 3, 2013 · 6421 views
    This topic created in 4663 days ago, the information mentioned may be changed or developed.
    git在clone一个私有的工程后,第一次需要输入用户名密码,之后 push pull都不需要输入用户名密码,它的权限验证放哪儿??

    os: OS X 10.8.4
    git: 1.7.12.4 (Apple Git-37)
    10 replies    2014-10-03 11:50:05 +08:00
    zhttty
        2
    zhttty  
       Sep 3, 2013
    https倒是没研究过,不过严重推荐使用ssh git的原生协议方式,密码存在~/.ssh目录文件下,一个私钥,一个公钥。
    clydelin
        4
    clydelin  
    OP
       Sep 3, 2013
    @ayanamist
    @zhttty

    我现在用 http://git.oschina.net/ 也就是 gitlab了。
    ~/.ssh 下没有公钥 私钥, ~/.netrc下也没有相关文件 我现在就很疑惑 为什么不用输入密码
    clydelin
        5
    clydelin  
    OP
       Sep 3, 2013
    @zhttty github 在 .ssh 确实有公钥私钥 我知道 但是 ,,,,osc 却没有所有我有这个疑问
    msg7086
        6
    msg7086  
       Sep 3, 2013
    你连接的时候是用https还是git@
    clydelin
        7
    clydelin  
    OP
       Sep 3, 2013
    @msg7086 https
    zhttty
        8
    zhttty  
       Sep 3, 2013
    @clydelin 我也在用,挺好的,1000个私有项目。

    开源项目github,私有的oschina
    kfll
        9
    kfll  
       Sep 3, 2013
    看源码吧
    https://github.com/git/git/blob/master/credential.c
    或者 man git-credential

    如果要保存到本地,看 git-credential-store 和 git-credential-cache,对应的源码看名字就能找到了。

    如果要看调用的地方,看 https://github.com/git/git/blob/master/http.c
    PHILO10
        10
    PHILO10  
       Oct 3, 2014
    我估计你要的是这个:
    git config --global credential.helper store

    你输入一次之后就会被记录账号密码以后就不用账号密码就能提交代码了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1631 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 16:29 · PVG 00:29 · LAX 09:29 · JFK 12:29
    ♥ Do have faith in what you're doing.