Day 26 : Git Manage Remotes | 100 Days of DevOps
Content:
Today I worked on managing Git remotes and pushing changes to a newly added remote repository as per the xFusionCorp development team’s requirement. The task involved adding a new remote, copying a file into the repository, committing changes, and pushing them to the new remote.
🔹 What I Learned
How to add a new remote repository in Git
How to verify configured remotes
How to push code to a specific remote (not just origin)
🔹 Steps I Followed
1. Connected to Storage Server
ssh natasha@ststor01
2. Navigated to Repository
cd /usr/src/kodekloudrepos/official
3. Switched to Root User
sudo su
4. Added New Remote
git remote add dev_official /opt/xfusioncorp_official.git
5. Verified Remotes
git remote -v
6. Copied File into Repository
cp /tmp/index.html .
7. Checked Current Branch
git branch
8. Added and Committed Changes
git add index.html
git commit -m "Added index.html file"
9. Pushed Master Branch to New Remote
git push dev_official master
🔹 My Understanding
This task helped me understand how Git supports working with multiple remotes in a single repository. Instead of pushing changes only to the default origin, we can configure additional remotes like dev_official and push code to different repositories as needed.
🔹 What I Found Interesting
I found it interesting that Git allows multiple remotes to coexist, and we can selectively push branches to any of them. The flexibility of naming remotes (like dev_official) makes it easier to manage different environments or teams. It shows how powerful Git is for distributed development workflows.
📌 Full notes: GitHub link