Ubuntu系统中git每次提交都要输入密码怎么办?

在ubuntu系统中,不少用户反映在使用Git时,经常会遇到需要频繁输入密码的情况,在每次提交代码的时候都要求输入密码,输入正确密码后能正常的登录和使用git 。很多用户觉得每次提交都要输入密码很麻烦,那么,Ubuntu系统中git每次提交都要输入密码怎么办?该怎么避免呢?
【Ubuntu系统中git每次提交都要输入密码怎么办?】

Ubuntu系统中git每次提交都要输入密码怎么办?


操作步聚如下:
1: cd 回车;进入当前用户目录下;
2: vim .git-credentials (如果没有安装vim 用其它编辑器也可以或 sudo apt-get install vim 安装一个)
3:按照以下格式输入内容:
https://{username}:{password}@github.com
其中username,password,github.com 都换成你自己的内容
4:保存退出后执行下面命令
git config --global credential.helper store
执行完后
/home/用户名/.gitconfig 会新增一项
helper = store
这是再执行git push/pull的时候就不会在要求你输入密码了 。
当然,还有一种方式就是在git clone 的时候,不用https://的形式,而用git@git (ssh)的形式 。这种方式也可以避免每次都要输密码 。
最后,如果是在Mac os x或Uindows平台下,还可以用sourcetree 这样的ide工具,不过现在好要FQ才能下载了 。
以上就是Ubuntu系统中git每次提交都要输入密码的解决办法,有需要的用户可参考上面介绍的方法来避免git每次提交都要输入密码的麻烦 。

    推荐阅读