:一下均是个人进行社区贡献遇到问题汇总及经验总结,如有雷同,纯属巧合!


1. 切换到master分支
    git checkout master 
2. 查看所有分支
    git branch -a 
3. 删除 stable/bug/1709830分支
   1709830分支,删除的目的是切换其他分支到 stable/bug/1709830和这个bug对应,要在master分支下删除其他分支
    git branch -D stable/bug/1709830 
4. 切换到bug对应的分支,/bug/bug_id
    git checkout -b stable/bug/1709830 remotes remotes/gerrit/stable/16.04
5. git 就是对已经存在的commit 进行apply (可以理解为再次提交)
    git cherry-pick <commit id>:单独合并一个提交
    git cherry-pick -x <commit id>:同上,不同点:保留原提交者信息
    git cherry-pick -x e7527d17a6ce2f6f3d6e78b6fe4723696aa93e1c(commit id)
6. 查看是否有冲突,修改冲突
    git status


7. 删除不存在的文件
    git rm /hooks/charmhelpers/fetch/snap.py 


8. 在cherry-picking状态下执行:
    git commit 解决冲突,删除冲突的注释解决冲突,删除冲突的注释(和git commit --amend类似)


9. 删除分支
    git branch -D stable/bug/1709830


10. 下载review.ci上的一个已提交的(https://review.openstack.org/#/c/490019/)
    git review -d 490019
    10.1. 在更新项目之前进行
        git stash save
    10.2. git pull之后执行
        git stash pop


11. 测试29418端口是否可以通信
        ssh -vv -p 29418 [email protected]


12. 29418被墙:“ssh: connect to host review.openstack.org port 29418: Network is unreachable”


13. 找不到远程库
      git remote add gerrit ssh://[email protected]:29418/openstack/openstack-xxx.git


14. 查找文件
      find /etc/ | xargs grep paste --color=auto 查找到所有的paste的ini配置文件。


15. openstack git review 29418被墙解决办法
    登录https://review.openstack.org/#/settings/http-password,生成password,如果password里面有反斜杠,然后再点击直到没有斜杠为止。
    有斜杠的在使用时会报错:Could not resolve host:  **** error: 不能获取 gerrit
    >git clone https://github.com/openstack/python-cinderclient.git
    >cd keystone
    >git remote -v
    origin    https://github.com/openstack/python-cinderclient.git (fetch)
    origin    https://github.com/openstack/python-cinderclient.git (push)
    >git remote add gerrit https://username:[email protected]/openstack/python-cinderclient.git(没有gerrit)
    >git remote set-url gerrit https://username:[email protected]/openstack/python-cinderclient.git(有gerrit)
    >git remote -v
    gerrit    https://username:[email protected]/openstack/python-cinderclient.git (fetch)
    gerrit    https://username:[email protected]/openstack/python-cinderclient.git (push)
    origin    https://github.com/openstack/python-cinderclient.git (fetch)
    origin    https://github.com/openstack/python-cinderclient.git (push)


16. 替换文件中的中文回车符号,再提交社区之后发现Zuul检测不过,是因为文件在windows下打开过,执行以下命令可修复
    #sed -i ‘s/\r//g’ filename   #删除file内的windows回车,尽量在linux环境下执行
    #git add -A #将目标文件添加到本地库
    #git commit --amend #修改commit信息,若无需修改,保存退出即可
    #git review #重新提交,检测即可通过


17. Https down下来的代码配置提交时的用户名和密码
    git clone https://git.openstack.org/openstack/nova
    Vim ./git/config
    [remote "gerrit"]
            url = https:zhangbailin:[email protected]/openstack/nova.git
            fetch = +refs/heads/*:refs/remotes/gerrit/*


18. git review报错如下
    fatal: The remote end hung up unexpectedly
    fatal: The remote end hung up unexpectedly
    error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
    Everything up-to-date
    原因:推送的文件太大
    在项目目录下配置.git/config文件即可
    vim .git/config #增加以下内容
    [http]
    postBuffer = 524288000
    OpenStack社区贡献问题总结--经验

后续更新尽请期待......:)

相关文章: