Cloud code gitee complete tutorial (clone deployment)

1. Create a warehouse

Log yard cloud https://gitee.com/ create a warehouse
480452-20200309160102467-925559127.jpg

2. Use the git locally initialization

(1) Create a directory to store downloaded items, I created a "gitspace" folder on the D drive, used to store downloaded items
1

(2) enter just the new folder, that is, into "gitspace", click the right mouse button and select "Git Bash Here", as shown below:
2

After clicking "Git Bash Here", you can see the following interface
3

(3) Perform basic configurations, as a basic configuration of git, git role is to tell who you are, the information you enter will appear in your submission created, use the following two commands:

  git config --global user.name "你的名字或昵称"
  git config --global user.email "你的邮箱"

Results are as follows:
4

(4) Execute the following command in gitspace folder, complete initialization

   git init
   git remote add origin <你的项目地址> //注:项目地址形式为:https://gitee.com/xxx/xxx.git或者 [email protected]:xxx/xxx.git

Results are as follows:
5

(5) If you want to clone, only you need to execute the command

git clone <项目地址>

Results are as follows:
6

Pop-up window, enter the name of the account code of the cloud, password

7

Click "OK"

8

Look at gitspace folder already downloaded the

9

(6) into the directory you have initialized good or cloning project, and then execute:

# 从服务器下更新项目,因为已经clone过,所以不需要再更新
git pull origin master 

3. submit the project to the cloud code

Do some changes in local projects, such as adding a "description .txt" files
480452-20200309161044564-730302582.png
execute the following command to complete the first submission

# 保存到缓存区,或 git add 被拖入的项目名
git add .
# 描述这次提交的内容 (推送到本地库中)
git commit -m “要描述的内容”
# 推送到远端仓库码云上,项目大的话,时间会久些
git push origin master

Note: If the last step in error, you can use git push -f origin masterto mandatory coverage.

   git push origin master //(正常提交)和
   git push origin master -f //(强制提交,强制提交可能会把之前的commit注释信息,不会改变修改的代码,慎用),都是提交到master分支

480452-20200309161205695-1949195171.png

480452-20200309161212392-783567197.png

Other common git commands

  • View all branch: git branch -a

  • Switching to a branch: git checkout branchname

  • Merge branch: git merge original branch target branch

4. Update code to local

  1. git status (see local branch file information, to ensure that no conflict of updates)

  2. git checkout - [file name] (file if there are changes, you can revert to the original state; if files need to be updated to the server, you should merge to the server, and then update to the local)

  3. git branch (branch to view the current situation)

  4. git checkout remote branch

  5. git pull

If the command is successful, the update code is successful!

It can be used directly: git pull command to update the code step

5. Review and modify user information

Modify the user name and password

git config --global user.name "username"  
git config --global user.email "email"  

Check your username and password

git config user.name  
git config user.email  
Published 124 original articles · won praise 9 · views 20000 +

Guess you like

Origin blog.csdn.net/p445098355/article/details/104766195