白茶清风无别事  

由于网络原因我用ssh方法拉取代码每次都提示远程服务连接失败,因此我用了https方式去拉去代码。

这种方式拉取代码每次操作都要输入密码,为了解决这个问题做了一下操作:

  1. 在命令行输入 git config --global credentail.helper store
  2. 接着在命令行 git pull 拉去代码,此时需要输入密码
  3. 再往后的操作 pull push 都不用在输入密码

我在虚拟机中使用上述方法不起作用,用https拉去代码每次都要输入账号和密码,因此加了凭据管理器

  1.  建立凭据文件  $ touch ~/.git-credentials
  2. 在文件中加入带凭据的url信息  https://HAliyuxin:(冒号后面输入密码)@github.com
  3. 告诉git使用该凭据  $ git config --global credential.helper store
  4. 执行完上面命令会在git配置文件 ~/.gitconfig 中设置一个凭据地址 

    [credential]

      helper = store

 

posted on 2020-08-25 13:52  _Pluto  阅读(2382)  评论(0编辑  收藏  举报