每次push 到github时使用和不使用username 和password ( on windows )

来源:互联网 发布:java方法重写快捷键 编辑:程序博客网 时间:2024/06/05 09:04

最近在公司都在使用win7,在使用git时和mac稍有些差异。当从本地push代码或是文档到github时,每次都要输入用户名和密码,多少有些繁琐,用下面的命令就可以避免这个小问题:

git config --global credential.helper store

这行命令执行完后没有任何提示,没有提示就是最好的提示。接下来再去push时就不会提示让输入用户名和密码了。但是如果你还想再使用密码时该怎么办呢?再用下面的命令:

git config --global credential.helper get

命令运行完之后 ,也是没有任何提示,然后你每次push的时候就又会提示你输入用户名和密码了,但是有个小问题就是,它会有下面这个提示,说get不是git command。

E:\gitRepo>git push origin mastergit: 'credential-get' is not a git command. See 'git --help'.Username for 'https://github.com': stanbersPassword for 'https://stanbers@github.com':

目前看来是可以简单的实现你所想要的结果。

参考:https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E5%87%AD%E8%AF%81%E5%AD%98%E5%82%A8

阅读全文
0 0
原创粉丝点击