最近重裝了一次win10系統(tǒng),導(dǎo)致開發(fā)環(huán)境需要重新搭建
一· 安裝JDK
現(xiàn)在下載JDK需要注冊https://login.oracle.com/mysso/signon.jsp
的賬戶
-
配置JAVA_HOME,CLASSPATH,Path
JAVA_HOME


二·安裝Git
- 地址: https://git-scm.com/downloads
- 配置 Git
$ git config --global user.name "xiaowugui"
$ git config --global user.email xiaowugui@example.com
詳細(xì)配置參考: https://git-scm.com/book/zh/v2/%E8%87%AA%E5%AE%9A%E4%B9%89-Git-%E9%85%8D%E7%BD%AE-Git
- 配置Git-ssh,打開git Bash操作
- 生成密鑰
ssh-keygen -t rsa -C "xiaowugui@example.com - 添加密鑰到ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

3.登陸Github, 將.ssh/id_rsa.pub添加 ssh https://github.com/settings/keys

4.測試,你將會看到
ssh -T git@github.com
Hi humingx! You’ve successfully authenticated, but GitHub does not provide shell access.

- 如果報錯,請刪除
rm -rf .ssh/known_hosts:
connection reset
避免git clone和push時每次都需要輸入用戶名和密碼
有三種方式解決git clone時每次都需要輸入用戶名和密碼,
1. SSH免密方式
使用git bash ssh-keygen或puttygen.exe生成公鑰。
配置全局開機(jī)存儲認(rèn)證信息
下面命令會將下次彈框的賬號和密碼保存起來,永久使用。
git config --global credential.helper store
如果想要清除該賬號和密碼,使用如下命令:
git config --global credential.helper reset
想要臨時存儲(默認(rèn)15min),使用如下命令
git config --global credential.helper cache
windows下的臨時存儲命令不是上面的,應(yīng)該使用下面的命令
git config --global credential.helper wincred

3. 地址中攜帶用戶信息
在https鏈接里加入username:password。
git remote add origin https://username:password@xxx.git

