GitLab 入门
发布: (2026年1月4日 GMT+8 03:42)
2 min read
原文: Dev.to
Source: Dev.to
什么是 Git
Git is a distributed version control system used to track changes in source code during software development.
It allows multiple developers to work on the same project, maintains a complete history of changes, and helps manage different versions of code efficiently.
版本控制系统
A Version Control System (VCS) is a tool that tracks and manages changes to files over time, allowing users to view history and revert to previous versions.
版本控制系统的类型
1. 本地版本控制系统
- 将版本存储在一台电脑上。
2. 集中式版本控制系统
- 将所有版本存储在一个由多个用户访问的中心服务器上。
- 示例:SVN
3. 分布式版本控制系统
- 每个开发者在本地机器上拥有完整的仓库副本,包括完整的历史记录。
- 示例:Git
什么是 GitLab
GitLab is a web-based DevOps platform that uses Git for version control and provides tools to manage the entire software development lifecycle, including code hosting, collaboration, CI/CD, and project management.
如何将文件推送到 GitLab
# Step 1: navigate to the project directory
cd
# Step 2: initialize a repository
git init
# check status
git status
# Step 3: add files
git add
# or add all files
git add .
# Step 4: commit changes
git commit -m "message"
# Step 5: push to remote
git push
什么是仓库
A repository is a storage location for source code files and folders, supporting collaboration among developers and maintaining a history of changes.
托管
Hosting provides server space and resources to make a website or application available online. It can be accessed over the internet.
本地托管
Local hosting runs a website or application on a local computer instead of an internet server. It is used for development, testing, and learning purposes.
托管工具: XAMPP, WAMP, MAMP
服务器
A server is a computer or system that provides resources, data, or services, handling client requests via a request‑response model.
示例: web server, file server, database server, application server.