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/cluster.git
Clone this Git repository to the /usr/src/kodekloudrepos directory. Perform this task using the natasha user, and ensure that no modifications are made to the repository or existing directories, such as changing permissions or making unauthorized alterations.
Step 1: SSH Into the Storage Server
From the jump host, connect to the Storage Server as natasha:
ssh natasha@ststor01 # password: Bl@kW
If the hostname doesn't resolve, use the server's IP address instead:
ssh natasha@10.244.49.64 # password: Bl@kW
Once connected, you'll see a prompt like:
[natasha@ststor01 ~]$
Step 2: Navigate to the Target Directory
Move into the directory where the repository should be cloned:
cd /usr/src/kodekloudrepos
Verify you're in the right place:
pwd
Expected output:
/usr/src/kodekloudrepos
Step 3: Clone the Repository
Clone the bare repository from /opt/cluster.git into the current directory:
git clone /opt/cluster.git
Expected output:
Cloning into 'cluster'...
warning: You appear to have cloned an empty repository.
done.
ℹ️ Note: The "empty repository" warning is completely normal. It simply means the repository has no commits yet — the clone itself was successful.
This creates a new folder named cluster inside /usr/src/kodekloudrepos.
Step 4: Verify the Clone
Move into the cloned directory:
cd cluster
Check the remote configuration:
git remote -v
Expected output:
origin /opt/cluster.git (fetch)
origin /opt/cluster.git (push)
Confirm the directory contents:
ls -la
You'll see the .git/ directory — this is the working copy of the repository.
Step 5: Confirm Ownership
Ensure everything is owned by natasha, since the clone was performed under that user:
ls -la /usr/src/kodekloudrepos
Expected output:
drwxr-xr-x 3 natasha natasha 4096 Oct 6 05:18 cluster
And inside the cloned folder:
ls -la /usr/src/kodekloudrepos/cluster
Expected output:
drwxr-xr-x 3 natasha natasha 4096 Oct 6 05:18 .
drwxr-xr-x 3 natasha natasha 4096 Oct 6 05:18 ..
drwxr-xr-x 6 natasha natasha 4096 Oct 6 05:18 .git
Every entry should show natasha natasha — confirming the clone is correctly owned. ✅
Step 6 (Optional): Document the Clone with a Heredoc
If you want to leave a log or note file describing the clone, use a heredoc to write it without opening an editor:
cat <<'EOF' > clone-info.txt
Repository cloned: /opt/cluster.git
Destination: /usr/src/kodekloudrepos/cluster
Cloned by user: natasha
Date: $(date)
Notes:
- Bare source repo, non-bare working copy.
- No permissions or ownership were modified.
EOF
Verify:
cat clone-info.txt
⚠️ Only create this file if your task allows adding new files. If the instructions say "no modifications," skip this step.
Recap: What We Did
| Step | Action |
|---|---|
| 1 | SSH'd into the Storage Server as natasha
|
| 2 | Navigated to /usr/src/kodekloudrepos
|
| 3 | Cloned /opt/cluster.git with git clone
|
| 4 | Verified the remote with git remote -v
|
| 5 | Confirmed ownership with ls -la
|
| 6 | (Optional) Documented the clone using a heredoc |
Common Pitfalls to Avoid
| Pitfall | Why It's a Problem |
|---|---|
Using git init instead of git clone
|
Creates a brand-new empty repo, not a copy of the source |
| Cloning as the wrong user | Files will be owned by that user, breaking team access |
Adding sudo unnecessarily |
Files become root-owned, causing permission issues |
| Worrying about "empty repository" warning | This is expected for repos without commits |
Modifying permissions with chmod/chown
|
Often prohibited; not needed when cloning as the right user |
Key Takeaways
- Clone as the correct user — ownership follows whoever runs the command.
-
git clone <path>works with local paths, not just URLs. - The "empty repository" warning is not an error.
- Always verify with
git remote -vandls -la. -
Use heredocs (
<<'EOF') to write files cleanly without opening an editor. -
Avoid unnecessary
sudo— it changes file ownership.
Top comments (0)