Setup Git Repository on Server
The Nautilus development team has provided requirements to the DevOps team for a new application development project, specifically requesting the establishment of a Git repository. Follow the instructions below to create the Git repository on the Storage server in the Stratos DC:
- Utilize yum to install the git package on the Storage Server.
- Create a bare repository named /opt/demo.git (ensure exact name usage).
Steps
-
Login to Storage Server and Install git
sudo yum update -y
sudo yum install -y git
-
Create a bare repository
sudo git init --bare /opt/demo.git
Good to Know?
Git Repository Types
- Working Repository: Contains working directory with checked-out files
- Bare Repository: Contains only Git data, no working directory
- Purpose: Bare repos used for sharing/collaboration (central repositories)
- Location: Usually stored on servers for team access
Bare Repository Benefits
- No Working Directory: Prevents conflicts when pushing
- Central Hub: Multiple developers can push/pull
- Server Storage: Efficient storage on servers
- Collaboration: Standard for team development workflows
Git Installation
- Package Managers:
yum, apt, dnf for Linux distributions
- Version Control: Track changes in source code
- Distributed: Every clone is a full repository
- Branching: Lightweight branching and merging
Repository Naming
- Convention: Use
.git suffix for bare repositories
- Descriptive Names: Choose meaningful repository names
- Path Structure: Organize repos in logical directory structure