Upload Local project to Docker running Gitlab container

Source: Internet
Author: User

1 The client's Ssh-key is configured on Gitlab or the password needs to be entered

 gitlab默认是以http方式进行上传的,但是文件过大,nginx与gitlab的默认配置限制了客户端像服务器传送文件的大小  当前 环境当中gitlab是以docker来跑的一个容器,端口映射发现失败,所以直接修改

2 Problem Solving

1 log on to the server, modify the configuration file

    docker exec –it gitlab /bin/bash                    find / -name gitlab.rb                    vim /etc/gitlab/gitlab.rb                     /gitlab_shell_ssh_port                                    #在vim编辑器中找到此行                     gitlab_rails[‘gitlab_shell_ssh_port‘] = 2222    #并且修改为这个样子,将ssh端口改为2222                     :wq!                                                               #保存并退出                     exit                                                                #退出当前容器            2 docker restart gitlab                                           #重新启动该容器

3 Back to Windows, unzip the file to be uploaded

    1 在解压后的文件夹右击选中”Git Bash Here”(前提是电脑安装了Git Bash),

    2 在命令行中使用ssh-keygen –t rsa –C “[email protected]”(此处的[email protected]为你要用哪个用户上传就写哪个用户的邮箱地址,本人用的root)生成密钥文件,命令敲完以后默认回车即可,

3 找到密钥生成的位置,此处为C:/Users/Administrator/.ssh/id_rsa.pub,并将内容复制到gitlab上,按照以下步骤找到gitlab上配置ssh-key的地方

1

2

3

4 then execute the following command in sequence on the command line

            1 cd test            #进入到要上传的项目的文件夹中            2 git init            #初始化此目录,使git可以管理这个文件夹            3 git config --global user.name "administrator"            4 git config --global user.email "[email protected]"            5 git remote add origin ssh://[email protected]”gitlab地址”/“项目用户”/”项目名称” #后面的那些在gitlab上面新建项目的时候就会指定,并且可以看到            6 git add .       #在Windows上这个命令刚开始会报错,使用第五步解决            7 git config core.autocrlf false            8 git add .       #重新执行,等待,时间可能会比较长,因为文件较大            9 git commit –m “test version” #提交并且指定提交后的信息            10 git push –u origin master #将当前目录下的分支推送到主分支        5 为了保持安全性,再次登录到运行的容器gitlab上将那一行删掉,并且重启容器                            1 docker exec –it gitlab /bin/bash            2 vim /etc/gitlab/gitlab.rb                # gitlab_rails[‘gitlab_shell_ssh_port‘] = 2222 #注释这一行            3 docker restart gitlab            #重启目标容器生效

Upload Local project to Docker running Gitlab container

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.