记一次Android开发环境搭建
2020-02-02 本文已影响0人
小乌龟爸
最近重装了一次win10系统,导致开发环境需要重新搭建
一· 安装JDK
现在下载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
详细配置参考: 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生成公钥。
配置全局开机存储认证信息
下面命令会将下次弹框的账号和密码保存起来,永久使用。
git config --global credential.helper store
如果想要清除该账号和密码,使用如下命令:
git config --global credential.helper reset
想要临时存储(默认15min),使用如下命令
git config --global credential.helper cache
windows下的临时存储命令不是上面的,应该使用下面的命令
git config --global credential.helper wincred

3. 地址中携带用户信息
在https链接里加入username:password。
git remote add origin https://username:password@xxx.git