Android开发之Git配置

                                                    Android开发之Git配置

      

1.首先git配置:

输入命令:

         git config --global user.name "xxx.xx"

         git config --global user.email "xxx.xx@x.com"

         git config --global commit.template "/home/xxx/commit.template"

名字改成自己的。

可以通过git config --global --list查看命令是否配置:

user.name=xxx.xx

user.email=xxx.xx@x.com

commit.template=/home/xxx/commit.template

2.配置ssh:

输入命令:

         ssh-keygen

然后一路回车,结束后,到根目录下的.ssh文件夹中,

输入命令:

         touch config

新建config文件,添加下面内容:

Host 192.168.10.x

User xxx.xx

Port 29418

IdentityFile ~/.ssh/id_rsa

Host 192.168.10.xx

User xxx.xx

Port 29418

Hostname 192.168.10.xx

IdentityFile ~/.ssh/id_rsa

Host 192.168.10.xxx

User xxx.xx

Port 29418

Hostname 192.168.10.xxx

IdentityFile ~/.ssh/id_rsa

不要忘记修改User。

将id_rsa.pub中的全部内容拷贝到gerrit上,上述三个服务器都要添加SSH Public Keys。在浏览器上输入Host后面的地址登录服务器,如果服务器上没有账号注册一个。

SSH Public Keys位置在setting中:

点击add key,将复制的内容拷贝进来,如下:

点击add就ok了。

回到服务器,repo代码的时候会出现提示,输入yes回车即可。

原文地址:https://www.cnblogs.com/cxqd/p/5893969.html