Branch Creation
Objective
Create a new Git branch named xfusioncorp_blog
from the master
branch in the /usr/src/kodekloudrepos/blog
repository on the Storage server. This branch will be used by the development team to implement new features, while ensuring the current production code remains unaffected.
Environment
-
Server: Storage Server (
ststor01
) -
Repository Path:
/usr/src/kodekloudrepos/blog
-
Branch Created:
xfusioncorp_blog
-
Base Branch:
master
-
User:
natasha
(operations performed withsudo
due to repository ownership)
Implementation Steps
- Navigate to the repository:
cd /usr/src/kodekloudrepos/blog
-
Switch to the
master
branch:
sudo git checkout master
-
Create and switch to the new branch
xfusioncorp_blog
:
sudo git checkout -b xfusioncorp_blog
- Push the new branch to the remote repository:
sudo git push origin xfusioncorp_blog
Verification
- Verified the branch exists locally:
sudo git branch
Output included:
* xfusioncorp_blog
master
- Verified the branch was successfully pushed to the remote:
sudo git branch -r
Output included:
origin/master
origin/xfusioncorp_blog
Issues Faced / Lessons Learned
- Dubious Ownership Warning
- Git flagged the repository as a “dubious ownership” directory since it was owned by
root
. -
Resolution: Added the path as a safe directory:
git config --global --add safe.directory /usr/src/kodekloudrepos/blog
- Permission Denied on
.git/index.lock
- As the repository files were owned by
root
, write access was denied to thenatasha
user. - Resolution: Executed all Git commands with
sudo
to gain the required permissions.
- Lesson Learned
- When working with shared or system-owned repositories, always check directory ownership and permissions first.
- Using
sudo
is acceptable for one-off administrative tasks, but adjusting ownership (chown
) may be preferable for long-term developer use. - The
safe.directory
configuration is essential when Git detects mismatched user permissions in newer versions.
Result
The branch xfusioncorp_blog
has been successfully created from master
and pushed to the remote repository. All operations were completed without modifying the project code.
Top comments (0)