This project demonstrates how to create a file in Git Bash, track it with Git, and commit it to a GitHub repository. It covers the essential steps for setting up a local Git repository, configuring Git, and pushing your changes to GitHub. This guide is perfect for anyone looking to improve their version control skills.
Before you begin, ensure you have the following installed:
- Git Bash: Download Git Bash
- GitHub Account: Sign up for GitHub
- Windows: Search for "Git Bash" in the Start menu and open it.
- Mac/Linux: Open the terminal application (Git is pre-installed on most distributions).
- Use the
cdcommand to move to the directory where you want to create your project.cd path/to/your/directory
- Create a new directory (if needed) and initialize it as a Git repository.
mkdir DevOps cd DevOps git init
- Use
vior your preferred text editor to create a new file.vi devops.txt
- Add content to the file:
Welcome to the DevOps Bootcamp. This is my first file created using Git Bash. - Save and exit the editor:
- Press
Esc, type:wq, and hitEnter.
- Press
- Stage the file for commit using
git add.git add devops.txt
- Verify that the file is staged and ready for commit.
git status
- Set up your global Git username and email.
git config --global user.name "YourUsername" git config --global user.email "youremail@example.com"
- Commit the staged file with a descriptive message.
git commit -m "First DevOps Cloud Bootcamp commit"
- Go to GitHub and create a new repository named
DevOps.
- Add the remote GitHub repository to your local Git setup.
git remote add origin https://github.com/YourUsername/DevOps.git
- Push your local commits to the GitHub repository.
git push origin master
- Visit your GitHub repository to ensure that
devops.txthas been successfully uploaded and committed.
By following this guide, you've successfully created a file in Git Bash, tracked it using Git, and committed it to GitHub. This foundational skill is essential for managing code versions and collaborating with other developers efficiently. Keep practicing to further enhance your version control expertise!
This project is licensed under the MIT License - see the LICENSE file for details.