如下几步:
首先要在eclipse中安装git插件,此插件版本必须和elipse版本匹配,在git官网可以查看到对应版本
第一步:在本地安装git客户端,下载地址https://github.com/git-for-windows/git/releases/download/v2.13.0.windows.1/Git-2.13.0-64-bit.exe
安装之后,在工作目录中右击鼠标,点击git brash here弹出git命令行
输入ssh-keygen生成key
生成如下秘钥
- From the Terminal or Git Bash, run ssh-keygen
- Confirm the default path .ssh/id_rsa
- Enter a passphrase (recommended) or leave it blank.
Remember this passphrase, as you will need it to unlock the
key whenever you use it. - Open ~/.ssh/id_rsa.pub and copy & paste the contents into
the box below, then click on "Add".
Note that id_rsa.pub is your public key and can be shared,
while id_rsa is your private key and should be kept secret.
配置好公钥之后,在项目根目录下安装commit-msggit ,打开git命令行,在命令行中输入git clone ssh://wangfeng@192.168.1.236:29418/pmsas && scp -p -P 29418 wangfeng@192.168.1.236:hooks/commit-msg pmsas/.git/hooks/此地址,这个地址可以在如图地方获取
获取gerrit上的项目ssh地址进行项目下载到本地仓库
至此项目已经下载到本地仓库(我这里服务器上的项目只是一个空项目,需要对下载下来的空项目进行修改,我是把我本地的项目放到这个空项目中)
通过eclipse导入项目(import--》exsiting projects into workplace )
导入之后,鼠标放到项目上右击,team --》commit
remote --》 push 提交到服务器