• 13.gitlab搭建仓库及联通Jenkins


    gitlab搭建仓库及联通Jenkins

    gitlab创建仓库

    图 25

    Create blank project
    图 26

    仓库创建成功,有提示参考信息
    图 27

    gitlab配置SSH

    图 29

    git@192.168.222.128:root/gitlab_combat.git
    git@gitee.com:gavinxiexingfu/test_combat.git

    git remote rm origin

    git remote -v

    git关联多个仓库

    git remote add gitlab git@192.168.222.128:9001/root/gitlab_combat.git
    git remote add gitee git@gitee.com:gavinxiexingfu/test_combat.git

    git push gitee master
    git push gitlab master

    git remote rm gitee
    git remote rm gitlab

    git remote add gitlab http://192.168.222.128:9001/root/gitlab_combat.git

    git使用ssh推送到gitlab需要输入密码解决

    使用ssh推送代码到gitlab报错:需要输入密码,不管输入什么都报错

    $ git push gitlab master
    git@192.168.222.128's password:
    Permission denied, please try again.
    git@192.168.222.128's password:
    Permission denied, please try again.
    git@192.168.222.128's password:
    git@192.168.222.128: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    解决:Linux系统里面修改
    修改gitlab的端口
    文件:/etc/gitlab/gitlab.rb
    修改
    gitlab_rails['gitlab_shell_ssh_port'] = 8002

    重新启动容器,启动成功,重新关联仓库
    仓库地址自动带上ssh端口号
    ssh://git@192.168.222.128:8022/root/gitlab_combat.git

    gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)
    
     git remote add gitlab ssh://git@192.168.222.128:8022/root/gitlab_combat.git
    
    $ git remote -v
    gitee   git@gitee.com:gavinxiexingfu/test_combat.git (fetch)
    gitee   git@gitee.com:gavinxiexingfu/test_combat.git (push)
    gitlab  ssh://git@192.168.222.128:8022/root/gitlab_combat.git (fetch)
    gitlab  ssh://git@192.168.222.128:8022/root/gitlab_combat.git (push)
    
    gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)
    $ git push gitlab master
    The authenticity of host '[192.168.222.128]:8022 ([192.168.222.128]:8022)' can't be established.
    ECDSA key fingerprint is SHA256:Sq2//h6bepjalAUiqUUJlqcKcmJ2llQ2Bz6euw9f39E.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '[192.168.222.128]:8022' (ECDSA) to the list of known hosts.
    Everything up-to-date
    
    

    参考资料:
    https://www.it610.com/article/1281977795542532096.htm

    如果推送代码到仓库报错

    $ git push gitlab master
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that a host key has just been changed.
    The fingerprint for the ECDSA key sent by the remote host is
    SHA256:1qLaXYyZ/i8Y9Uvx3k89PTBXm4dpPHN3i/vi7xHCIyo.
    Please contact your system administrator.
    Add correct host key in /c/Users/gavin/.ssh/known_hosts to get rid of this message.
    Offending ECDSA key in /c/Users/gavin/.ssh/known_hosts:2
    ECDSA host key for [192.168.222.128]:8022 has changed and you have requested strict checking.
    Host key verification failed.
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
    

    解决方法:
    /c/Users/gavin/.ssh/known_hosts
    打开文件,删除gitlab记录
    然后删除仓库,重新关联仓库,然后就可以推送代码成功

    gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)
    $ git remote rm gitlab
    
    gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)
    $ git remote add gitlab ssh://git@192.168.222.128:8022/root/gitlab_combat.git
    
    gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)
    $ git remote -v
    gitee   git@gitee.com:gavinxiexingfu/test_combat.git (fetch)
    gitee   git@gitee.com:gavinxiexingfu/test_combat.git (push)
    gitlab  ssh://git@192.168.222.128:8022/root/gitlab_combat.git (fetch)
    gitlab  ssh://git@192.168.222.128:8022/root/gitlab_combat.git (push)
    
    gavin@LAPTOP-GPDG2OBO MINGW64 /d/py project/Merchants_combat/day6 (master)
    $ git push gitlab master
    The authenticity of host '[192.168.222.128]:8022 ([192.168.222.128]:8022)' can't be established.
    ECDSA key fingerprint is SHA256:1qLaXYyZ/i8Y9Uvx3k89PTBXm4dpPHN3i/vi7xHCIyo.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '[192.168.222.128]:8022' (ECDSA) to the list of known hosts.
    Enumerating objects: 277, done.
    Counting objects: 100% (277/277), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (253/253), done.
    Writing objects: 100% (277/277), 34.67 KiB | 1.24 MiB/s, done.
    Total 277 (delta 106), reused 0 (delta 0)
    remote: Resolving deltas: 100% (106/106), done.
    To ssh://192.168.222.128:8022/root/gitlab_combat.git
     * [new branch]      master -> master
    
    

    https://www.icode9.com/content-4-605691.html

    配置webhook

    图 53

    报错: Url is blocked: Requests to the local network are not allowed

    解决:
    图 54

    选择setting network
    图 55

    打勾
    图 56
    然后往下拉,点击save change

    Application settings saved successfully

    重新配置webhook
    点击test
    图 57

    404

    图 58

     Hook executed successfully but returned HTTP 404 <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 404 Not Found</title> </head> <body><h2>HTTP ERROR 404 Not Found</h2> <table> <tr><th>URI:</th><td>/project/test_free_style_gitlab</td></tr> <tr><th>STATUS:</th><td>404</td></tr> <tr><th>MESSAGE:</th><td>Not Found</td></tr> <tr><th>SERVLET:</th><td>Stapler</td></tr> </table> <hr><a href="https://eclipse.org/jetty">Powered by Jetty:// 9.4.41.v20210516</a><hr/> </body> </html>
    

    图 59

    生成的token,需要放到webhook中
    p6XHTQdGo7Bvt6wqizHB

    http://192.168.222.128/root/gitlab_combat.git
    ssh://git@192.168.222.128:8022/root/gitlab_combat.git

    问题

    一个本地仓库关联两个远程仓库

    推送一个远程仓库成功,一个失败

    $ git push gitee master                                                          
    To gitee.com:gavinxiexingfu/test_combat.git                                      
     ! [rejected]        master -> master (fetch first)                              
    error: failed to push some refs to 'git@gitee.com:gavinxiexingfu/test_combat.git'
    hint: Updates were rejected because the remote contains work that you do         
    hint: not have locally. This is usually caused by another repository pushing     
    hint: to the same ref. You may want to first integrate the remote changes        
    hint: (e.g., 'git pull ...') before pushing again.                               
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.    
    

    解决;

    git push gitee master -f

    先pull另外一个成功的远程仓库内容到本地
    然后强制push成功的仓库内容到另外一个仓库同步

    $ git push gitee master -f
    Enumerating objects: 329, done.
    Counting objects: 100% (329/329), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (305/305), done.
    Writing objects: 100% (329/329), 39.95 KiB | 1.38 MiB/s, done.
    Total 329 (delta 139), reused 0 (delta 0)
    remote: Resolving deltas: 100% (139/139), done.
    remote: Powered by GITEE.COM [GNK-6.1]
    To gitee.com:gavinxiexingfu/test_combat.git
     + 0275c9b...69445f8 master -> master (forced update)
    
    
  • 相关阅读:
    简单的NHibernate helper类,支持同一事务的批量数据处理
    外部唯一窗体
    Nhibernate常见的错误
    NHB下载地址
    oracle jdbc连接
    linux 中国发行版
    转:pl/sql develop的使用
    Oracle Database 10g Release 2 JDBC Drivers
    转:Setting up a Msysgit Server with copSSH on Windows
    oracle基础学习
  • 原文地址:https://www.cnblogs.com/xiehuangzhijia/p/15225851.html
Copyright © 2020-2023  润新知