git clone https:// don't input username and password

来源:互联网 发布:mysql临时表查询数据 编辑:程序博客网 时间:2024/05/29 19:01

Apart from changing to SSH you can also keep using HTTPS, if you don't mind to put your password in clear text. Put this in your~/.netrc and it won't ask for your username/password (at least on Linux):

machine github.com       login <user>       password <password>

Addition (see VonC's 2nd comment): on Windows the file name is %HOME%\_netrc.

Also read VonC's first comment in case you want to encrypt.

share|improve this answer
 
2 
Yeah, it works on Linux, but doesn't work for gitbash on Windows. – Sales Apr 12 '13 at 16:56
5 
From a security point of view, it is a very bad idea. – dolmen Sep 20 '13 at 14:17
2 
@dolmen I see what you mean, but if you mind putting your password in a clear text, you can... encrypt it ;) Seestackoverflow.com/a/18362082/6309. and that is even compatible with the 2-factor authentication (2FA) of Github:stackoverflow.com/a/18607931/6309 – VonC Nov 21 '13 at 8:29
2 
@Sales it works perfectly from a DOS session or a git bash on Windows, provided you call your file%HOME%\_netrc (instead of ~/.netrc). See also stackoverflow.com/a/18362082/6309 to encrypt that file. –  VonC Nov 21 '13 at 8:30
 
This also works in Mac. Great – Guixing Bai Dec 19 '13 at 4:52
0 0
原创粉丝点击