Day 13 of my DevOps Journey. I broke a commit today. On purpose. And it fixed everything.🔥 Today I learned Git Reset and how to securely connect your server to GitHub - HTTPS vs SSH. First - The Real-World Problem that taught me Git Reset: Two developers. One repo. Dev1 had commits C1→C5. Dev2 added C6. Dev1 didn't pull C6 and made C7. Now Dev1 tries to push — ERROR. Why? Git expects order: C1, C2, C3, C4, C5, C6, C7. But Dev1 has C7 with no C6. The history is broken. The fix? Delete the commit, but keep the data. The command is "git reset --soft HEAD~1" C7 commit disappears. The work stays. Now pull C6 from Dev2. Recommit C7. Push succeeds.✅ Second — HTTPS vs SSH: Two ways to connect server to GitHub HTTPS → needs a token every time SSH → generate once, push forever HTTPS Token steps (short version): Profile → Settings → Developer Settings → Personal Access Tokens → Tokens (Classic) → Generate → select repo scope → copy to Notepad SSH Key steps: · ssh-keygen → press Enter 3 times · cd ~/.ssh then ll → you'll see two files · id_rsa = private key (stays on server) · id_rsa.pub = public key (goes to GitHub) · cat id_rsa.pub → copy the output · GitHub → Settings → SSH Keys → paste → done · Now push without credentials. Ever again. 🔑 —————————————— See you on Day 14 #DevOps #Git #GitHub #SSH #100DaysOfDevOps #Day13
Git Reset and HTTPS vs SSH: DevOps Lessons Learned
More Relevant Posts
-
Explain a scenario where you used git fork instead of git clone. Why was forking necessary 🤔 ... ✅ I used git fork when I contributed to a DevOps project in my org on GitHub. Since I didn’t have write access to the original repository, I forked it into my GitHub account, made changes, and then created a pull request from my fork to the upstream repo. 📘 Detailed Explanation In this scenario, the original repository belonged to an organization. I wanted to fix a bug in their Helm chart setup for Kubernetes deployments. Because I didn’t have contributor rights to push directly, I used the Fork button on GitHub to create a personal copy of the repository under my own GitHub username. From there: I cloned my fork to my local system:git clone https://lnkd.in/gWYH6Y6e Created a new branch, made the fix, committed the changes. Pushed the branch to my fork:git push origin bugfix-helm-values Finally, I submitted a pull request to the original repository. Using git clone directly on the upstream repo wouldn't have helped because I couldn’t push changes or open a PR without a fork. So, forking gave me independence and write access on my own terms, while still contributing back to the main project.
To view or add a comment, sign in
-
🚀 DevOps Journey – Day 17 / 100 Today I learned a real-world Git scenario that every developer faces 🔥 ⸻ 🔹 🔐 Git with SSH (Secure Way) • Generate SSH key → ssh-keygen • Add public key to GitHub SSH settings • Use SSH URL instead of HTTPS 👉 git remote add origin <SSH_URL> 👉 git push origin branchname 💡 No more entering username/password every time! ⸻ 🔹 ⚙️ Basic Config (Recap) • git config --global user.name "yourname" • git config --global user.email "youremail" ⸻ 🔹 📏 Sigma Rule of Git (Golden Rule) 👉 Always PULL before PUSH ⚠️ ⸻ 🔹 🔥 Real-Time Scenario (Important) 1️⃣ Change a file directly in GitHub 2️⃣ Commit changes in GitHub 3️⃣ Now from Local: • Modify same file • Try git push ❌ → ERROR 👉 Why? Because local repo is outdated ⸻ 🔹 🛠️ Solution ✔️ First try: git pull ❌ Still conflict? 👉 Fix using: • git reset --soft HEAD~1 • git stash • git pull • git stash apply • Resolve conflicts • git push ✅ ⸻ 🔹 🔀 GitHub Merge • Use Compare & Pull Request • Review changes • Merge safely into main branch ⸻ 💡 Pro Tip: Most Git errors happen due to not pulling latest changes Follow the rule → Pull → Modify → Push Consistency makes you industry-ready 💪 #DevOps #Git #GitHub #Linux #VersionControl #100DaysOfDevOps #LearningJourney #Cloud #Automation #RealTimeScenario #frontlinesedutech #flm #frontlinesmedia #MultiCloudDevops
To view or add a comment, sign in
-
-
If a change isn’t in Git, it didn’t happen. That’s not something I’m adopting for this build, it’s something I stopped tolerating. In it-re-dc01, everything lives in one place: Ansible roles. Terraform modules. Docker Compose stacks. Helm charts. Docs. Runbooks. ADRs. One repo: it-re-dc01-infra. GitHub Actions runs on a self-hosted runner on re01-mgmt-01. Every push triggers: • ansible-lint • docker compose validation • terraform validate Merges to main trigger applies. Terraform state is not local. It’s stored and secured via Vault-backed workflows. Secrets don’t live in the repo. They’re issued dynamically. Git defines the desired state. Vault secures access to it. GitHub Actions enforces the path to change. No manual changes. No exceptions. I’ve seen what happens without this discipline. At one point, we ran Jenkins where the pipeline configuration lived inside Jenkins itself. When Jenkins went down, the pipelines went with it. We rebuilt them from memory and screenshots and it took two weeks. That wasn’t a tooling issue, it was a process failure. The tool doesn’t matter, the discipline does. No change, no matter how small or urgent, happens outside the pipeline. Because if your system can’t be rebuilt from Git, you don’t control it. #GitOps #PlatformEngineering #CI/CD
To view or add a comment, sign in
-
-
𝗗𝗮𝘆 𝟯𝟬 𝗼𝗳 𝗺𝘆 𝗗𝗲𝘃𝗢𝗽𝘀 𝗝𝗼𝘂𝗿𝗻𝗲𝘆 💻 Cleaning up Git history — used hard reset to remove unwanted commits and restore a clean state 🔥 𝗧𝗮𝘀𝗸: Git Hard Reset 𝗪𝗵𝗮𝘁 𝗜 𝗹𝗲𝗮𝗿𝗻𝗲𝗱 𝘁𝗼𝗱𝗮𝘆: • How `git reset --hard` rewrites commit history • Difference between `git revert` (safe) vs `git reset` (destructive) • Importance of identifying the correct commit before resetting • Why force push is required after history rewrite • Risks of using hard reset in shared environments 𝗪𝗵𝗮𝘁 𝗜 𝗯𝘂𝗶𝗹𝘁 / 𝗽𝗿𝗮𝗰𝘁𝗶𝗰𝗲𝗱: • Navigated to repo `/usr/src/kodekloudrepos/beta` • Checked commit history using `git log --oneline` • Identified target commit (`add data.txt file`) • Performed `git reset --hard <commit-id>` • Verified only required commits remain • Force pushed changes using `git push origin master --force` 𝗖𝗵𝗮𝗹𝗹𝗲𝗻𝗴𝗲𝘀: • Understanding when it’s safe to rewrite history • Ensuring correct commit is selected before reset • Awareness of impact on remote repositories 𝗙𝗶𝘅 / 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴: • Learned that `git reset --hard` permanently removes commits • Understood why force push is necessary after reset • Realized this approach should be used carefully in team environments • Gained clarity on cleanup strategies for test repositories 𝗞𝗲𝘆 𝗧𝗮𝗸𝗲𝗮𝘄𝗮𝘆: With great power comes great responsibility — `git reset --hard` is powerful, but should be used only when you’re absolutely sure. This felt like performing a controlled cleanup in a real DevOps environment 🚀 When do you prefer using reset vs revert in your workflow? #Day30 #DevOps #Git #VersionControl #Linux #Automation #CloudComputing #AWS #DevOpsJourney #LearningInPublic #100DaysOfDevOps
To view or add a comment, sign in
-
-
I just built my first CI/CD pipeline from scratch. It broke 10+ times before it worked. Here's what happened. As part of my DevOps bootcamp (TechWorld with Nana), I set up a complete Jenkins pipeline for a NodeJS application. The goal: every code change should be automatically tested, built into a Docker image, pushed to Docker Hub, and versioned — no manual steps. The setup: • Ubuntu VM running on VirtualBox • Jenkins running as a Docker container with the host's Docker socket mounted • Jenkinsfile defining 5 pipeline stages: version bump, test, build, push, commit • GitLab for source code, Docker Hub for images What went wrong (and what I learned): First, GitLab authentication broke the pipeline. My password had special characters that mangled the git URL. The fix: use a Personal Access Token instead. Lesson — never use passwords with special characters in CI/CD URLs. Tokens are safer and cleaner. Then, Jenkins couldn't build Docker images. "Permission denied" on the Docker socket. Even though the socket was mounted, Jenkins runs as a non-root user. The fix: chmod 666 on the socket inside the container. Lesson — mounting a socket isn't enough, the permissions have to match. The result: a fully automated pipeline that increments the app version, runs tests (pipeline stops if tests fail), builds a Docker image with the new version tag, pushes it to Docker Hub, and commits the version bump back to GitLab. One command triggers all of this. That's CI/CD. Biggest takeaway: CI/CD isn't just about writing a Jenkinsfile. It's about understanding how Jenkins, Docker, Git, and your application all connect. You're the bridge between all these tools. Module 8 progressing. Still building, still breaking things, still learning. #DevOps #Jenkins #CICD #Docker #Pipeline #GitLab #Automation #LearningInPublic #CareerChange #TechWorldWithNana
To view or add a comment, sign in
-
-
🚀 Day 5/7 – Git & GitHub Journey | Debugging & Restore Power Today was all about fixing mistakes in Git like a pro 🔥 Because real developers don’t just write code… they debug & recover smartly. 💡 Focus: Git Debugging & Restore Commands Mistakes are common: ❌ Wrong file changes ❌ Accidental commits ❌ Deleted important files 👉 Today I learned how to fix ALL of these using Git itself. ⚙️ Practical Tasks I Performed: ✅ 1. Checked file changes Used git status and git diff Understood staged vs unstaged changes ✅ 2. Restored modified files git restore filename 👉 Reverted file back to last committed state ✅ 3. Unstaged files git restore --staged filename 👉 Removed file from staging area ✅ 4. Undo last commit (without losing code) git reset --soft HEAD~1 ✅ 5. Completely discard changes git checkout -- filename (older way) 🧠 Key Learning: Git is not just version control… It’s a complete recovery system if you know the right commands 💪 🔥 Real DevOps Insight: In real projects, mistakes happen frequently. Knowing how to debug and restore safely saves time, code, and production issues. 📂 Skills Gained: Git Debugging 🔍 Code Recovery ♻️ Safe Commit Handling Better Development Workflow #Day5 #Git #GitHub #DevOps #Debugging #LearningInPublic #Automation #AWS #Cloud #DevOpsJourney
To view or add a comment, sign in
-
-
🚀 Just finished the Docker course on Boot.dev! 🚀 I’m excited to share that I’ve learned the fundamentals of Docker—a key technology in modern DevOps and CI/CD pipelines. Docker makes it simple and fast to deploy new versions of code by packaging applications and their dependencies into preconfigured environments. This not only speeds up deployment, but also reduces overhead and eliminates the “it works on my machine” problem. Docker is a core part of the CI/CD (Continuous Integration/Continuous Deployment) process, enabling teams to deliver software quickly and reliably. Here’s a high-level overview of a typical CI/CD deployment process: The Deployment Process: 1. The developer (you) writes some new code 2. The developer commits the code to Git 3. The developer pushes a new branch to GitHub 4. The developer opens a pull request to the main branch 5. A teammate reviews the PR and approves it (if it looks good) 6. The developer merges the pull request 7. Upon merging, an automated script, perhaps a GitHub action, is started 8. The script builds the code (if it's a compiled language) 9. The script builds a new docker image with the latest program 10. The script pushes the new image to Docker Hub 11. The server that runs the containers, perhaps a Kubernetes cluster, is told there is a new version 12. The k8s cluster pulls down the latest image 13. The k8s cluster shuts down old containers as it spins up new containers of the latest image This process ensures that new features and fixes can be delivered to users quickly, safely, and consistently. image credit: Boot.dev Docker course #docker #cicd #devops #softwaredevelopment #bootdev #learning
To view or add a comment, sign in
-
-
🔧 Real DevOps problems I solved this week — and what I learned. Setting up a full CI/CD pipeline from scratch sounds simple until you hit the real-world issues nobody talks about in tutorials. Here's what broke and how I fixed it 👇 ❌ Issue 1 — Jenkins wouldn't start Root cause: My Docker container (Tomcat) was already occupying port 8080. Jenkins also defaults to 8080. Simple conflict, but it took reading journalctl logs to find it. ❌ Issue 2 — App deployed but returned 404 Root cause: Tomcat maps WAR filenames directly to URL paths. maven-web-app.war serves at /maven-web-app — not /. Spent 20 minutes on this one. ❌ Issue 3 — Jenkins couldn't run Docker commands Root cause: Jenkins user wasn't in the docker group. One command fixed it: sudo usermod -aG docker jenkins ✅ End result: A working Jenkins pipeline that — → Clones code from GitHub → Builds WAR with Maven → Builds Docker image → Pushes to DockerHub The biggest lesson? Read the logs first. Always. #DevOps #Jenkins #Docker #AWS #CI_CD #CloudEngineering #Linux
To view or add a comment, sign in
-
🚀 GitLab Migration: A Story Between Old Repo & New Repo 😄 So I recently had to migrate projects from one GitLab to another… and honestly, it felt like shifting houses 🏠 🔹 Step 1: Packed everything git clone --mirror 👉 “Take EVERYTHING. Even things I forgot existed.” 🔹 Step 2: Moved to new place git push --mirror 👉 “Congrats, new GitLab… you now have my entire past.” 🔹 Step 3: Panic moment 😱 Error: “deny updating a hidden ref” 👉 Me: “WHAT DID I BREAK???” 👉 GitLab: “Relax… that’s just merge request stuff.” 🔹 Step 4: Trust issues 👉 Checked commits 👉 Checked branches 👉 Checked again… just in case 🔹 Step 5: Size mismatch 🤨 Old repo: 500 MB New repo: 480 MB 👉 Me: “WHERE ARE MY 20 MB???” 👉 Git: “Bro… I cleaned your mess.” 🔹 Reality check 💀 ❌ Members didn’t come ❌ Permissions didn’t come ❌ Pipelines didn’t come 👉 Basically moved house… but forgot the people 💡 Final lesson: If commits match → You’re safe If branches match → You’re happy If no errors → Don’t overthink 😄 #DevOps #GitLab #Migration #Git
To view or add a comment, sign in
-
𝗚𝗶𝘁 - 𝗧𝗵𝗲 𝗱𝗮𝗶𝗹𝘆 𝗧𝗶𝗽 As we all know git is one the most powerful tool we have, here are some tips to "optimize" your daily work 𝙗𝙧𝙖𝙣𝙘𝙝.𝙨𝙤𝙧𝙩 -𝙘𝙤𝙢𝙢𝙞𝙩𝙩𝙚𝙧𝙙𝙖𝙩𝙚 What 𝚋𝚛𝚊𝚗𝚌𝚑.𝚜𝚘𝚛𝚝 -𝚌𝚘𝚖𝚖𝚒𝚝𝚝𝚎𝚛𝚍𝚊𝚝𝚎 Does When you set this configuration, any command that lists branches (like 𝚐𝚒𝚝 𝚋𝚛𝚊𝚗𝚌𝚑) will sort them based on the 𝗱𝗮𝘁𝗲 𝗼𝗳 𝘁𝗵𝗲 𝗹𝗮𝘀𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 made to that branch. 𝗦𝘁𝗮𝗻𝗱𝗮𝗿𝗱 𝗯𝗲𝗵𝗮𝘃𝗶𝗼𝗿: • Branches are listed A-Z. 𝗪𝗶𝘁𝗵 𝘁𝗵𝗶𝘀 𝘀𝗲𝘁𝘁𝗶𝗻𝗴: • The branches with the most recent activity appear at the bottom of the list (closest to your prompt), making them much easier to find in a repository with dozens of stale branches. 𝗣𝗿𝗼-𝗧𝗶𝗽: Adding More Detail • If you want an even more powerful view of your recent work, you can create a "𝘀𝘂𝗽𝗲𝗿 𝗮𝗹𝗶𝗮𝘀" that shows the date and the last commit message: • Set alias 𝙜𝙞𝙩 𝙘𝙤𝙣𝙛𝙞𝙜 --𝙜𝙡𝙤𝙗𝙖𝙡 𝙖𝙡𝙞𝙖𝙨.𝙧𝙡 "𝙗𝙧𝙖𝙣𝙘𝙝 --𝙨𝙤𝙧𝙩=-𝙘𝙤𝙢𝙢𝙞𝙩𝙩𝙚𝙧𝙙𝙖𝙩𝙚 --𝙛𝙤𝙧𝙢𝙖𝙩='%(𝙖𝙪𝙩𝙝𝙤𝙧𝙙𝙖𝙩𝙚:𝙧𝙚𝙡𝙖𝙩𝙞𝙫𝙚)%𝟬𝟵%(𝙧𝙚𝙛𝙣𝙖𝙢𝙚:𝙨𝙝𝙤𝙧𝙩)%𝟬𝟵%(𝙨𝙪𝙗𝙟𝙚𝙘𝙩)'" You just created a powerful new Git alias named 𝚛𝚕 (Recent List). 𝗨𝘀𝗮𝗴𝗲: 𝗴𝗶𝘁 𝗿𝗹 Enjoy.... #GIt #DevOps
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development