ssh-keygen -t rsa -C "youremail@example.com" 路徑以下 /Users/zhouqirui/.ssh/id_rsa
//路徑 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
//項目根目錄下配置GIT git config remote.origin.push refs/heads/*:refs/for/*
// 使用 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 代替,見下問
'更正上一次提交' 選項 該用法確保使用上一次記錄從新提交,使用上次生成惟一 commit ID
//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.正常提交
推薦使用這個辦法配置 sourectree 快捷操做作處理。路徑必須指定對應分支,格式以下: git push ssh://zhouqirui@192.168.31.65:29418/IOS HEAD:refs/for/develop
網上提示使用以下做提交,然而本人測試不管如何都沒法單個分支提交成功.全部找了 git-review 替代 git push git push origin HEAD:refs/for/master
參考github
brew install git-review
//新建文件 nano .gitreview //設置 git review -s //使用 在要提交的分支下使用,而且配置文件要統一,有錯誤就按提示作處理就能夠了. git review //等待審覈
[gerrit] host=172.18.200.198 port=29418 project=IOS defaultbranch=master ## 這個路徑要對應不一樣倉庫處理
更詳細說明請點擊shell