Skip to content

Latest commit

 

History

History
79 lines (52 loc) · 2.97 KB

Clone Git Repository on Storage Server.md

File metadata and controls

79 lines (52 loc) · 2.97 KB

Problem Statement

The DevOps team established a new Git repository last week, which remains unused at present. However, the Nautilus application development team now requires a copy of this repository on the Storage Server in the Stratos DC. Follow the provided details to clone the repository:

The repository to be cloned is located at /opt/official.git

Clone this Git repository to the /usr/src/kodekloudrepos directory. Ensure no modifications are made to the repository during the cloning process.

Solution

1. Login into the Storage Server

Command:

ssh natasha@ststor01

Description: This command establishes a Secure Shell (SSH) connection to the storage server ststor01 with the username natasha. Make sure you have the appropriate credentials and permissions to access the server and manage repositories.

2. Create the Target Directory

Command:

mkdir -p /usr/src/kodekloudrepos

Description: The mkdir -p command creates the directory /usr/src/kodekloudrepos. The -p flag ensures that the command creates any necessary parent directories and does not throw an error if the directory already exists. This is the target location where the repository will be cloned.

3. Clone the Git Repository into the Newly Created Directory

Command:

git clone /opt/official.git 

Expected Output:

Cloning into bare repository '/usr/src/kodekloudrepos/official.git'...

Description: This command clones the existing Git repository located at /opt/official.git into a new bare repository located at /usr/src/kodekloudrepos/official.git. The --bare option ensures that the repository is created without a working directory, which means it will only contain the Git data (metadata and object database) and no checked-out files. The output confirms the start of the cloning process and indicates the target directory.

4. Verify the Clone

Command:

cd /usr/src/kodekloudrepos/official.git
ls -la

Description: Change to the directory where the repository was cloned and list its contents using ls -la. This command shows detailed information about the files and directories within /usr/src/kodekloudrepos/official.git, allowing you to confirm that the repository was cloned successfully.

Expected Output:

total 40
drwxr-xr-x 7 root root 4096 Aug 13 03:44 .
drwxr-xr-x 1 root root 4096 Aug 13 03:43 ..
drwxr-xr-x 8 root root 4096 Aug 13 03:44 objects
-rw-r--r-- 1 root root  230 Aug 13 03:44 config
-rw-r--r-- 1 root root  230 Aug 13 03:44 description
-rw-r--r-- 1 root root  230 Aug 13 03:44 HEAD

Description: The output shows the contents of the cloned bare repository. Key files and directories such as config, description, HEAD, and objects are present. This confirms that the repository has been cloned correctly and is in the proper format.


This solution provides a clear and accurate method for cloning a Git repository and verifying its successful creation.