【Notes】git,gitlab,docker


1.git

1.1 download and install software win_git

Git official website: https: //git-scm.com/ download version window, press Win + R key on the keyboard, input cmd. All the way to next installation, find "Git" in the Start menu -> "Git Bash", or right-click the new folder on the desktop to display the following
Here Insert Picture Description
Git与Github的连接与使用:transfers between the local Git repository GitHub repository and is transmitted through SSH encryption, need to identify whether GitHub you push, GitHub just know that your public key, you can confirm that only you can push:

1.2 git connector provided github

1.Creating SSH Key, in the user's home directory (C: \ Users \ Administrator) down to see if there .ssh file (ubuntu with ctrl + h to display hidden files), and if so, look at the file and there is no id_rsa id_rsa.pub these two documents, if you already have, directly to the next step. If not, open Git Bash, enter the command, create SSH Key

$ ssh-keygen -t rsa -C "[email protected]" #123... 是你自己注册GitHub的邮箱

Here Insert Picture Description
Appears on the map, they said created successfully, go to the user's home directory to find the .ssh folder, there are id_rsa and id_rsa.pub two documents, both SSH Key is secret key pair, id_rsaprivate key, it can not be leaked, id_rsa.pubis the public key can be made public.
2.Next to GitHub, open the "settings-Account-SSH" page and click "Add SSH Key", fill in the Title (random write), the Key text box and paste id_rsa.pubthe entire contents of the file.
Here Insert Picture Description
3.Verify successful, enter the following command in the git bash in, careful not to $copy into it

$ ssh -T git@github.com # 这行不用改

If the first set, the following interface will appear, enter yes agree to
Here Insert Picture Description
4.the following start setting up username and email, because github commit every time they are recorded

git config --global user.name  "name" #你的GitHub登陆名
git config --global user.email "[email protected]" #你的GitHub注册邮箱
git config --list #查看设置

1.3 git command to upload the github

Right-click on the desktop point Git Bash Here, the command line git clone 新建库链接, so the downloaded folder contains .git文件夹, no git init, LICENSE may MIT license.
1 工作目录(红): Visible
2. git服务器暂存区(绿)
3. git服务器本地仓库
4 github远程仓库: Visible

1-2:git add . :当前文件夹里的文件即文件夹都添加进来
2-3:git commit -m "你的信息"
3-4:git push origin master

git status #1,2后即来显示红绿
git log #3后即commit后

1.4 to reduce the number of remote repository commit github

New github repository --clone to the desktop --cd just downloaded to the desktop library folder new four files in order git add 新建的4个文件名, git commit -m""in the master branch library 123456 git pushupload github Similarly figure below
Here Insert Picture Description
New 5.txt on github page, the local command line executes git pull, the local extra 5.txt, this time on the display 5 commits github. Command git logagain git rebase -i 8c26e(-i parameter is the combined hash value need not commit, in this case the first commit, and then proceeds to vi edit mode, press the arrow keys and key del)
Here Insert Picture Description
Pick means is to be performed this commit, squash mean a commit before the commit will be merged into. to pick squash or S, and esc: wq save and exit into the commit message editing interface as shown, to a non-comment line and then esc: wq save and exit.
Here Insert Picture Description
git logCheck local have been merged, git push -fforced to cover the remote github display only twice submitted.
Here Insert Picture Description

2gitlab

ubuntu: sudo apt-get install git, you can directly git clone ... github project (this one not only with the githubconnection key), but the ubuntu as shown connected gitlabto git clone and win as
Here Insert Picture Description

2.1 construction group

Here Insert Picture Description
Here Insert Picture Description
The following is a sample template
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

2.2 New

Local New Folder git clone are two directories
Here Insert Picture Description
add can select the new
Here Insert Picture Description
red exclamation mark indicates that the local directory and local git server (not gitlab remote server) are not synchronized show finished after Add
Here Insert Picture Description
another git back git commit with the local server synchronization display green
Here Insert Picture Description
and then git push gitlab synchronized to the remote server
Here Insert Picture Description

2.3 modify, delete

The exclamation mark is displayed and then modify the local directory and local git server are not synchronized
Here Insert Picture Description
at this time do not Add, because the version already, simply commit, push
the following graph 删除: first commit, pull, push
Here Insert Picture Description

2.4 comparison, the reduction

Here Insert Picture Description
The following two full ctrl FIG selected for execution
Here Insert Picture Description
as shown below 还原: the implementation of selected downlink, master will jump downlink
Here Insert Picture Description
Here Insert Picture Description

2.5 GitFlow

masterThe most stable branch reservation code feature a(sub-branch to task team members) on the development submitted to the develop(also known as the developer branch) merged, project leader agreed to merge. developBranch absorbed a lot feature a,b,c... function and come out of the releasebranch (testing, documentation), and then merged into master, hotfixthe branch is an emergency repair master and then merge back
Here Insert Picture Description

3.Docker

Docker is mainly used linux virtual machine and back-office applications, consists of the following three parts
镜像like ubuntu image file (iso, img file)
容器is a running virtual machine
仓库is stored image file spaces (dockerhub)
Here Insert Picture Description

3.1 common commands

ubuntu install command: sudo apt install docker.io, Website: play with docker
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
交互方式:port mapping, file mapping,
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
click No. 100 port as follows: The above is dockerfile build into a mirror run into a container
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

3.2 organize more than one container project: docker-compose

Host (etho) generates a docker mounted docker网卡between the container through the same network segment ip通信, and the container is a through host communications over the forward routing network card (端口通信), such as deployed in the container 1 is mysql container, the container 2 in the desired direct access, then access 172.27.0.2 port number 3306 can be a
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
more than able to get nginx container data, but in this way need to log in to view a machine ip, then log on to another machine to configure this ip, in the actual production it is not feasible, the following is true of the production process of communication -link
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
the need to write two way link by docker run, and you must first create mysql trouble, these instructions to record a configuration file unified configuration, which is docker- compose
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
create php test.php used to monitor whether the operation successfully
Here Insert Picture Description
Here Insert Picture Description
create mysql.php
Here Insert Picture Description
Here Insert Picture Description
create nginx.conf
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
started writing docker-compose
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
click on the following port 80
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Published 37 original articles · won praise 112 · views 20000 +

Guess you like

Origin blog.csdn.net/weixin_43435675/article/details/99543674