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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/stanxl/article/details/78728119

最近在公司都在使用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 master
git: 'credential-get' is not a git command. See 'git --help'.
Username for 'https://github.com': stanbers
Password for 'https://[email protected]':

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

参考: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

猜你喜欢

转载自blog.csdn.net/stanxl/article/details/78728119