有个python的脚本供大家参考:
#!/usr/bin/env python
# coding=utf-8
# for git clone helper
import os, sys
GERRIT_SERVER="xxx.xx.xx.xx" ####这里写gerrit服务器IP
GERRIT_LISTEN_PORT="29418" ####这里指定端口
GIT_REPO_NAME=""
SSH_CLONE_FULL_CMD=""
GERRIT_HOOKS_CMD=""
WHOAMI=""
def hello():
print '\033[0;32;40m'
#print 50*('*')
print '\tGerrit source code clone tools'
print 50*("*")
print '\033[0m'
def __exit(x):
sys.exit(x)
def error_color():
print '\033[0;31;40m'
def normal_color():
print '\033[0m'
def get_username():
global WHOAMI
WHOAMI = os.popen('whoami').read().strip()