標籤:
Android開發之Git配置
1.首先git配置:
輸入命令:
git config --global user.name "xxx.xx"
git config --global user.email "[email protected]"
git config --global commit.template "/home/xxx/commit.template"
名字改成自己的。
可以通過git config --global --list查看命令是否配置:
user.name=xxx.xx
[email protected]
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斷行符號即可。
Android開發之Git配置