https 方式每次都要输入密码,按照如下设置即可输入一次就不用再手输入密码的困扰而且又享受 https 带来的极速
设置记住密码(默认15分钟):
git config --global credential.helper cache
如果想自己设置时间,可以这样做:
git config credential.helper 'cache --timeout=3600'
这样就设置一个小时之后失效
长期存储密码:
git config --global credential.helper store
增加远程地址的时候带上密码也是可以的。(推荐)
http://yourname:password@gitee.com/name/project.git
补充:使用客户端也可以存储密码的。
如果你正在使用ssh而且想体验https带来的高速,那么你可以这样做:
切换到项目目录下 :
cd projectfile/
移除远程ssh方式的仓库地址
git remote rm origin
增加https远程仓库地址
git remote add origin http://yourname:password@gitee.com/name/project.git
Update:
Git-for-Windows 默认带有 Git-Credential-Manager-for-Windows
Linux 和 Mac 用户可以使用: Git-Credential-Manager-for-Mac-and-Linux
安装文档:
https://github.com/Microsoft/Git-Credential-Manager-for-Mac-and-Linux/blob/master/Install.md
搞定,enjoy the speed!
难怪,谢谢提醒
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
我刚才用ssh方式:git pull
ssh_exchange_identification: Connection closed by remote host
fatal: The remote end hung up unexpectedly
ssh拉小更新其实还是快一点,不用输密码
确实,好几天了,太慢了,我还以为oschina要挂了 :)
TortoiseGit在自己的用户目录下(%USERPROFILE%)新建_netrc增加
machine git.oschina.net
login username
password password
这样你所有仓库匹配到git.oschina.net都会自动使用该账户密码
多谢分享。
为啥我 git config --global credential.helper cache
之后,每次push还是需要输入用户名和密码??
你可能没设置好,我这边是没有问题的
git config --global credential.helper store 试试这个
然后看看你的.gitconfig文件有没有
[credential]
helper = store
提示各位windows用户,可以下载git-credential-winstore,http://gitcredentialstore.codeplex.com/
下载直接安装即可。 git config --global credential.helper store
方式没有测试,因为已经通过安装git-credential-winstore了。希望楼下有人验证一下。
查看当前remote: git remote -v
更新remote:
git remote set-url origin https://git.oschina.net/username/YourRepo
git config --global credential.helper store
我的mac测试通过。
git config --global credential.helper store
win7下 测试OK
git config --global credential.helper store
这样会把账号密码明文存储到 ~/.git-credentials中
嗯,是的,永久保存嘛
赞一下
按上面的来,别输错了
原来http可以永久保存密码的,那我也不用ssh了
这几天使用下来https也不是很快,是问题也对https有影响?
mark下。
小白一个,刚刚学会SSH,又改成http了 我遇到这个 提示 , 求大神支招啊:)
fatal: could not read Username for 'http://git.oschina.net': No such file or directory...
http换成https
fatal: could not read Username for 'https://git.oschina.net': No such file or directory 不是吧、同样出问题
我用了最无脑的方法,哎..
eclipse能不能用https保存密码啊,求解
默认的credential.helper store会把密码以明文的方式存在与.gitconfig同目录下的.git-credentials文件中。git-credential-winstore利用Windows自带的凭证管理系统来存放密码,感觉会更安全一些。不过感觉速度好像会慢一些(也许是我的错觉)。
在我影像中因为 ssh 方式支持压缩,而https方式不支持压缩,所以ssh 方式应该速度上优于https的啊
为啥到了这里却是 https 速度快了
egit 怎么保存?
习惯了SSH 了
支持Gitflow哦~
error: The requested URL returned error: 401 Unauthorized while accessing https://git.oschina.net/konakona/********.git/info/refs
fatal: HTTP request failed
HTTPS方式是不是有最大上传限制?我不记得具体多少了,好像是25MB?公司有防火墙不让SSH方式过,只能用HTTPS,然后有一次我push了很久没push的一个C#.NET项目,然后就告诉我上传失败。Google后得知是上传量太大超过HTTPS方式限制。这个怎么解决?
用http不可以吗? 我感觉速度还行阿。
最后两步可以整合成一句:
git config remote.origin.url https://git.oschina.net/username/project.git
我是来测试下图片的:)
图片有点大,影响本文得阅读,已经删除,望谅解。
git push origin master
error: The requested URL returned error: 401 Unauthorized while accessing https://git.oschina.net/shine_forever/pyTest.git/info/refs
fatal: HTTP request failed
这个怎么解决啊!?
git remote -v 发出来看一下
git remote -v
origin http://git.oschina.net/shine_forever/pyTest.git/info/refs (fetch)
origin http://git.oschina.net/shine_forever/pyTest.git/info/refs (push)
不知道为什么,明明是https,后台总有的项目创建是http,有的是http是的!以前用都没问题,就是最近push都不成功!?
fatal: http://git.oschina.net/shine_forever/pyTest.git/info/refs/info/refs not found: did you run git update-server-info on the server?
fatal: http://git.oschina.net/shine_forever/pyTest.git/info/refs/info/refs not found: did you run git update-server-info on the server?
怎么回事
git init
全局不好使,我在项目下的./git/config文件里进行了设置后可以免登陆,希望对大家有用
OS:windows7 x64
为什么推荐使用HTTPS,不是SSH会更快吗?
两者都是差不多得,只不过ssh有时候可能服务不稳定,所以推荐https,最近ssh还是比较稳定得。
用户名或者密码含有@符号的何如拼接成 http://yourname:password@git.oschina.net/name/project.git 的形式
用户名或者密码含有@符号的何如拼接成 http://yourname:password@git.oschina.net/name/project.git 的形式
@ 替换成 %40 试试
3q
提交和拉去都要重新输入密码,这个怎么破?
git版本
win7_64位
远程地址换成带用户名和密码的。
有人解决了这个问题了嘛?
.git/config 修改为:
如何取消关注,每次都收到邮件,很繁琐,谢谢!
您好,在个人信息里面的通知修改。
@郑健 貌似在那个关了,和自己项目有关的通知也不会通过邮件发送了,能不能值通知和自己项目有关的和自己订阅的?
您的意思是不想关注git@osc这个对吧,那就在项目的右上角有个unwatch
@郑健 谢谢,不知何时watch了git@osc
@八面 增加远程地址的时候带上密码也是可以的。(推荐)
@郑健 你说的方式: http://yourname:password@git.oschina.net/name/project.git 我也有测试,依然是无法push
是我使用错误 还是git@osc的bug?急~~
多谢
以下是使用: 增加远程地址的时候带上密码 方式来git push的结果
这个肯定是密码的问题,你可以尝试重新修改下密码。
@郑健 尽管我已经unwatch,但是还是能收到
感这两个命令有什么区别吗?
@郑健 不好意思,第一个应该是winstore,当时没注意发错了,已更正,感谢提醒。
@shouldsimple 嘿嘿,我说呢,我一个字母一个字母的还对比了一下 - -. 感谢共享,Git@OSC有你更精彩!
大神!给跪!
谢谢。有用呢。
git-credential-winstore安装和使用方法,参见http://www.noanylove.com/2014/09/shi-yong-git-credential-winstore-bao-cun-https-fang-wen-mi-ma/
被坑了下,我在debian下测试ok的命令如下:
长期存储密码:
git config --global credential.helper store
移除远程ssh方式的仓库地址
git remote rm origin
增加https远程仓库地址
git remote add origin https://yourname:password@git.oschina.net/yourname/yourprojectname.git
or git remote add origin http://yourname:password@git.oschina.net/yourname/yourprojectname.git
示例 yourname:debian,password:123456创建的cinterview项目
git remote add origin https://debian:debian@git.oschina.net/debian/cinterview.git
最后两步可以整合成一句:
git config remote.origin.url https://git.oschina.net/username/yourprojectname.git
示例 yourname:debian,password:123456创建的cinterview项目
git config remote.origin.url https://git.oschina.net/debian/cinterview.git
几种方式都可以的。
Status changed to closed
good
mark
good
用户名或者密码含有@符号的,把符号换成 %40 既可
http://mail%40yourmail.com:password@git.oschina.net/name/project.git
用户名或者密码含有@符号的,把符号换成 %40 既可
https://mail%40yourmail.com:password@git.oschina.net/name/project.git
666
干嘛不生成ssh key?
@lichenyi-os-git 有不想用sshkey
的
@lichenyi-os-git 有人干设置设置不好
原来私有项目必须要带 用户名和密码才有更新,但是如果在终端直接去pull或者push就不需要。 因为之前已经配置过了全局的账户密码,但是使用PHP exec 去直接Git pull的时候还是一直提示 fatal: could not read Username for 'https://gitee.com': Device not conf,邮箱的@替换成 %40就OK了,看了这篇文章就解决了
git remote add origin http://yourname:password@gitee.com/name/project.git
这个方法,貌似password里面有!@#¥%等特殊字符会不成功。。。
Sign in to comment