DEV Community

Cover image for 4.Git Manage Remotes
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

4.Git Manage Remotes

Lab Information

The xFusionCorp development team added updates to the project that is maintained under /opt/ecommerce.git repo and cloned under /usr/src/kodekloudrepos/ecommerce. Recently some changes were made on Git server that is hosted on Storage server in Stratos DC. The DevOps team added some new Git remotes, so we need to update remote on /usr/src/kodekloudrepos/ecommerce repository as per details mentioned below:

a. In /usr/src/kodekloudrepos/ecommerce repo add a new remote dev_ecommerce and point it to /opt/xfusioncorp_ecommerce.git repository.

b. There is a file /tmp/index.html on same server; copy this file to the repo and add/commit to master branch.

c. Finally push master branch to this new remote origin.

Lab Solutions

Step-by-Step Solution

  1. Login to Storage Server
ssh natasha@ststor01.stratos.xfusioncorp.com
# password: Bl@kW
Enter fullscreen mode Exit fullscreen mode
  1. Switch to root
sudo su -
# password: Bl@kW
Enter fullscreen mode Exit fullscreen mode
  1. Go to the ecommerce repo
cd /usr/src/kodekloudrepos/ecommerce
# Verify repo state:
git status
Enter fullscreen mode Exit fullscreen mode

✅ a. Add the new remote

git remote add dev_ecommerce /opt/xfusioncorp_ecommerce.git
# Verify:
git remote -v
Enter fullscreen mode Exit fullscreen mode

✅ b. Copy /tmp/index.html and commit to master

cp /tmp/index.html .
# Verify:
ls
# Stage and commit:
git add index.html
git commit -m "Add index.html file"
Enter fullscreen mode Exit fullscreen mode

✅ c. Push master branch to the new remote

git push -u dev_ecommerce master
Enter fullscreen mode Exit fullscreen mode

Resources & Next Steps
📦 Full Code Repository: KodeKloud Learning Labs
📖 More Deep Dives: Whispering Cloud Insights - Read other technical articles
💬 Join Discussion: DEV Community - Share your thoughts and questions
💼 Let's Connect: LinkedIn - I'd love to connect with you

Credits
• All labs are from: KodeKloud
• I sincerely appreciate your provision of these valuable resources.

Top comments (0)