Article directory
一、Git、Github、Gitee
1.1 Overview
Git is an open source distributed version control system for agile and efficient handling of any project, small or large.
Github is a website that provides git services to users. In this way, we don't need to deploy the git system ourselves. We can directly register an account on the website and use the git service provided by the website.
Gitee, commonly known as code cloud, is a domestic Git-based code hosting and R&D collaboration platform.
Digital Management Platform
Vue3+Vite+VueRouter+Pinia+Axios+ElementPlus
Permission System-Mall
Personal blog address
1.2 Advantages of Code Cloud over Github
- Due to reasons that everyone knows, accessing Github will be very slow, and sometimes access will even fail. Since Code Cloud is a domestic platform, it allows you to experience flying speed.
- Compared with GitHub, in addition to providing a free Git warehouse, Code Cloud also integrates functions such as code quality inspection and project demonstration. For team collaboration development, Code Cloud also provides project management, code hosting, and document management services, which are free for small teams of less than 5 people.
2. Github or Gitee registration
2.1 Registration
If you still have a Github or Gitee account, please register first. The addresses are as follows:
Github: https://github.com/
Gitee: https://gitee.com/
Here, we use Gitee Code Cloud as an example to explain. Follow the steps specified on the website to register and log in.
2.2 Create a warehouse
After logging in, click the "+" sign in the upper right corner, click "New Warehouse", fill in the warehouse name, and click the "Create" button at the bottom after completing the filling.
Note: You only need to fill in the warehouse name here. Be sure not to select "Use Readme file to initialize the warehouse"
After creating the warehouse, the following interface appears, proving that the warehouse was successfully created:
Next, don't close the page yet and wait for the following steps to be completed...
3. Git download and installation
Download address: https://git-scm.com/downloads
Select the corresponding system platform, download it, and install it in a fool-proof way.
After the installation is complete, open Run --> Enter the CMD command and press Enter to open the command line window
Enter the following Git command
git --version
The version number appears, which means the git installation is successful.
4. Create a local warehouse
-
In the start directory, find the Git directory and select Git Bash below:
-
Click to open the git command line window:
-
In the Git Bash window, complete the creation of the warehouse through the following instructions:
cd d: //切换到指定盘符(这里演示D盘) mkdir mygit //创建一个新的文件夹并命名(mygit) dir | ls | ll //查看当前路径中所有的文件和文件夹 cd mygit //进入指定目录(mygit)
-
Warehouse initialization
git init //初始化仓库
At this time, there is an additional hidden .git file in the mygit directory
-
Use the following instructions to create a file and write its contents:
touch test.txt //创建一个新的文件test.txt cat test.txt //查看文件test.txt中的内容 echo 'This is a test file'>test.txt //将 ">" 前面的内容写入到 ">" 后面的文件 test.txt 中
-
Clear everything in Gitbash
reset //清屏
Now let’s actually upload the local files to the local warehouse:
The file test.txt created above, or the file copied from other disks, are all "not included in the cache". Once the file is deleted, it will never be found again. Not there
Put the file into the cache through the git add command. "File included in cache", can be found through git
git add test.txt // 将本地文件纳入缓存 如果是所有的文件,请使用"git add ."
Submit the file to the local repository through the git commit command. "Files included in the repository" can be found anywhere on the computer
git commit -m '描述内容' //将纳入缓存的文件纳入版本库
git status //查看文件文件夹在工作区,暂存区的状态 git log //查看历史提交记录