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

Git密码怎么保存的?

  •  
  •   clydelin · Sep 3, 2013 · 6835 views
    This topic created in 4808 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
    zhttty
    Sep 3, 2013
    2
    https倒是没研究过,不过严重推荐使用ssh git的原生协议方式,密码存在~/.ssh目录文件下,一个私钥,一个公钥。
    clydelin
    clydelin
    OP
    Sep 3, 2013
    4
    @ayanamist
    @zhttty

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

    开源项目github,私有的oschina
    kfll
    kfll
    Sep 3, 2013
    9
    看源码吧
    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
    PHILO10
    Oct 3, 2014
    10
    我估计你要的是这个:
    git config --global credential.helper store

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