在mac下配置Gerrit与SourceTree

参考资料


Gerrit工作流程及使用手册

环境配置


生成ssh key

ssh-keygen -t rsa -C "youremail@example.com"

路径如下
/Users/zhouqirui/.ssh/id_rsa

更改系统SSH配置

//路径 
sudo nano /etc/ssh/ssh_config

//增加如下内容
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
HostkeyAlgorithms ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1

配置 Gerrit Web SSH

git clone 路径 (建议用终端clone 用sourcetree 还要手动配置 hooks)

git配置

//项目根目录下配置GIT
git config remote.origin.push refs/heads/*:refs/for/*

自定义Push (sourcetree 自带PUSH不能使用,暂时没解决办法)

// 使用 git push
// 备注: (可以使用,但多分支下,回报错)

YW20170821003:IOS zhouqirui$ git push
Total 0 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 2, done    
To ssh://172.18.200.198:29418/IOS
 ! [remote rejected]     feature/raychow_develop -> refs/for/feature/raychow_develop (no new changes)
 ! [remote rejected]     master -> refs/for/master (duplicate request)
error: failed to push some refs to 'ssh://zhouqirui@172.18.200.198:29418/IOS'


// 使用  git push origin HEAD:refs/for/master
// 备注: 一直报错.. 

YW20170821003:IOS zhouqirui$ git push origin HEAD:refs/for/master
Total 0 (delta 0), reused 0 (delta 0)
remote: Branch refs/heads/refs/for/master:
remote: You are not allowed to perform this operation.
remote: To push into this reference you need 'Push' rights.
remote: User: zhouqirui
remote: Please read the documentation and contact an administrator
remote: if you feel the configuration is incorrect
remote: Processing changes: refs: 1, done    
To ssh://172.18.200.198:29418/IOS
 ! [remote rejected]     HEAD -> refs/for/master (prohibited by Gerrit)
error: failed to push some refs to 'ssh://zhouqirui@172.18.200.198:29418/IOS'

//使用 git-review 代替,见下问

使用


Gerrit 审核参考 (需要有权限)

审核不过(处理)

'更正上一次提交' 选项 

该用法确保使用上一次记录重新提交,使用上次生成唯一 commit ID

合并commit

//1.最近2条记录
git rebase -i HEAD~2

//2.合并改写 (退出命令 esc :wq)
pick b0f97ef7d c1
squash a61e4a8fb c2

# Rebase 8df25e817..a61e4a8fb onto 8df25e817 (2 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

//3. 查看记录
git log

//4.正常提交

上传方法1 - (git push 带参数)

使用原因

推荐使用这个办法配置 sourectree 快捷操作做处理。路径必须指定对应分支,格式如下:

git push ssh://zhouqirui@192.168.31.65:29418/IOS HEAD:refs/for/develop

上传方法2 - (git-review 安装与配置)


使用原因

网上提示使用如下作提交,然而本人测试无论如何都无法单个分支提交成功.所有找了 git-review 替代 git push

git push origin HEAD:refs/for/master

安装

参考

brew install git-review

配置命令配置

//新建文件
nano .gitreview

//设置 
git review -s

//使用 在要提交的分支下使用,并且配置文件要统一,有错误就按提示做处理就可以了.
git review

//等待审核
配置文件
[gerrit]
host=172.18.200.198
port=29418
project=IOS
defaultbranch=master ## 这个路径要对应不同仓库处理

更详细说明请点击

转载于:https://my.oschina.net/u/3729367/blog/1577658

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值