We're diving deep into GitHub and Git today, concentrating on important skills that any DevOps engineer should know how to perform. Let's examine these exercises to improve your knowledge of GitHub and Git.
1. Setting User Name and Email Address:
In Git, it's essential to configure your user name and email address, as these will be associated with your commits. You can set these globally or per repository using the following commands:
# Set globally (for all repositories)
git config --global [user.name](file:///C:\Users\ASUS\AppData\Local\Temp\msohtmlclip1\01\clip_filelist.xml) "Your Name"
git config --global [user.email](file:///C:\Users\ASUS\AppData\Local\Temp\msohtmlclip1\01\clip_filelist.xml) [youremail@example.com](file:///C:\Users\ASUS\AppData\Local\Temp\msohtmlclip1\01\clip_filelist.xml)
2. Creating a GitHub Repository:
Before connecting your local repository to GitHub, you need a repository to link to. On GitHub, you can create a new repository by following these steps:
Log in to your GitHub account.
Click the "+" sign in the upper right corner and select "New repository."
Give your repository a name, such as "Devops."
You can choose to make it public or private, add a README file, and select a license if needed.
Click "Create repository" to finalize the process.
3. Connecting Local Repository to GitHub:
Go to your local repository directory using the terminal. Initialize a Git repository if you haven't already used git init.
Add your GitHub repository as a remote using the following command, replacing <username> with your GitHub username and <reponame> with the repository name:
- git remote add origin [github.com<username>/<reponame>.git](file:///C:\Users\ASUS\AppData\Local\Temp\msohtmlclip1\01\clip_filelist.xml)
4. Creating a New File and Pushing to GitHub
mkdir Git
echo "This is my Day 2 content." > Git/Day-02.txt
Next, add and commit the file:
git add .
git commit -m "Added Day 2 content"
Finally, push your local commits to GitHub:
- git push -u origin master
In conclusion, developing these abilities is essential for DevOps engineers in order to manage code, work with teams, and guarantee a seamless software development process.
#Linux #DevOps #cloud #AWS #community
#techenthusiast #Devops #CloudComputing
Follow for more: