Posts

Showing posts with the label git

Exploring git pre-commit for Secrets leaks

Image
What is GitGaurdian and ggsheild? The ggsheild is a security CLI tool developed by GitGuardian that helps developers and organizations prevent the exposure of sensitive information, such as API keys, credentials, and secrets, in their Git repositories. What are key features of ggsheild? Pre-Commit and Pre-Push Scanning: Scans code before it is committed or pushed to detect secrets. Prevents accidental leaks of sensitive data in version control. CI/CD Pipeline Integration: Works with GitHub Actions, GitLab CI/CD, Jenkins, and other CI tools. Ensures security checks are part of automated workflows. Real-Time Monitoring and Alerts: Detects exposed secrets in public or private repositories. Sends alerts and suggests remediation steps. Custom Rules & Policies: Allows defining custom regex patterns to detect organization-specific secrets. Supports allowlists to prevent false positives. How to install ggsheild on Ubuntu 24.04? apt update apt in...

Handling Git Large file system on repositories - git-lfs

Image
Hey, hello, dear DevOps, DevSecOps, and SRE team heroes!! Here I came across a new challenge to solve the common problem on Git. You may be using GitHub or GitLab or even Bitbucket for source code management. Now, a few projects, websites, or mobile apps require storing images, audio files, or video files that are larger in size. During the transfer to the client systems, they are facing the following issues: Slowness in git clone and fetch operations: files taking too long to upload or download, leading to delays in deployment and user experience Sluggish commits and status checks: some clients are encountering errors related to file size limitations, causing frustration and hindering workflow efficiency Repository size bloat Complexity in managing multiple branches It's crucial for us to explore solutions that can streamline this process and ensure smooth handling of large sized media files. Git LFS installation on Ubuntu Using the package manager command we can ...

Git installation on Ubuntu 24.04

Image
Git installation on Ubuntu is pretty simple. If you are looking for git instatlling on the RHEL or Rocky or Oracle Linux you can use this link . Now most of the software projects are using Git. So let's do installation on Ubuntu wit the following steps: Check for Git exists Install Git Confirm Git Installation Pre-requisites: Pick an instance on Cloud or online terminal of Ubuntu 20+ version to this experiment. Here I'm using the KillerCoda provided Ubuntu. Check for Git exists This is a common requirement when you join a new project and on the Linux machine you would like to know git installed or not. We have couple of options to check it. Let's do it here: dpkg -l git #or dpkg --list git In the output first 'ii' in the list means (if there are packages installed, you should see this mark) that the package is correctly installed and available. alternatively you can also try other option to check git installation on Ubuntu. apt list g...

Bitbucket Server installation on Linux

Image
Bitbucket is most widely used in the IT industry to provide team collaborative work for short size of teams. Its greater ability is to have integration with Jira and other DevOps tools. Bitbucket encourages private repository creation by default. So they are mostly not available for search engines to discover these projects! So, startup projects will do better here. Prerequisites for Bitbucket installation JRE/JDK: To run the web UI Java is required, Your system must have the JRE/JDK, we can go with the Open JDK as you know that Oracle JDK is now not open to everyone to download! Git: To run the Bitbucket we need Git as a source-code management tool. Ensure the default port 7990 is available on the system. If you are running on the Cloud ensure the TCP port /7990 allows inbound traffic. On the AWS you need to update the Security Group that associated with the EC2 instance. Option of Vagrant box  Vagrant.configure(2) do |config| config.vm.box = "centos/8" c...

Undoing changes - git reset

Image
Hello Guys!! HEAD pointer movement HEAD points to specific commit in the local repo-branch as new commits are made, the pointer changes HEAD always points to the "tip" of the currently checked-out branch in the repo (not the working directory or staging index) last state of repo (what was checkout initially HEAD points to parent of next commit(where writing next commit takes place) HEAD Movement in Git branches Git Reset movements This is most common need of every DevOps team development phase need. There are three options we have but of course two of them are mostly used. Git reset movements at three tree levels soft mixed hard Using --soft reset The soft reset command is to combine many commits into a single one. git reset --soft HEAD (going back to HEAD) git reset --soft HEAD^ (going back to the commit before HEAD) git reset --soft HEAD~1 (equivalent to "^") git reset --soft HEAD~2 (going back to 2 commits before HEAD) Using hard reset mov...

GitHub Personal Access Token (PAT) for Linux Users

Hey Greetings of the day!! GitHub providing Personal Access Token instead of using username, password for git repository that is on the GitHub. where git subcommands such as git pull, git push, fetch and any remote operations will be depends on this PAT.   There are two choices for PAT  1. fine grain Personal Access Token(PAT)  2. Personal Access Token (Classic)  I understood that it is easy to change permissions, authentication token that use only specific target repositories.  If you want to know ' How PAT works? Where to start PAT ' then this post is absolutely for you! Welcome to this 2 mins read! Fine grained PAT newly introduced in Oct 2022 on the GitHub still at the time this post it is mentioned as [Beta] versioned. Personal Access Token PATS are going to work with commonly defined API on GitHub. Any integration made simplified with this method. How to create PAT on GitHub?  Login to your GitHub account. Click on the profile picture upper-ri...

Git Config different scopes

Image
Hello DevOps or DevSecOps team here in this post I would like to expose more details about how the Git configurations can be done and viewed and where it is going to stored as file. Git Basic Configurations and scopes Let's see what are options we have for "git config" command in a Linux system, here I've used Ubuntu Linux to execute all 'git config' commands.  git config scopes There are three different levels : local, global, system-level configuration values attributes defined in Git.  System Global Local System level config Git allows us to define System wide configuration that means the configured values will be available for all users in the system and for every project repository as well. # System level configurations will be stored in /etc/gitconfig file git config --system core.editor "vim" git config --system merge.tool "vimdiff" The execution of the commands  git config --global command example Global level config Git c...

Git Stashing

Image
Hello DevOps/DevSecOps team Guys!! As you know we are learners always shine with 'Learning by doing'. In this post exploring the git stashing it's nice to know how you can keep code in safer for reuse after sometime or after some other code commits getting back.   What is Git Stash means? Stashing takes the dirty state of your working directory — that is, your modified tracked files and staged changes — and saves it on a stack of unfinished changes that you can reapply at any time (even on a different branch). To demonstrate stashing, you should go into your project and start working on a couple of file(s) and possibly stage one of the changes. Power of git stash Why do we need git stashing? We have already git commit command right then why stashing? You can commit your code and switch to another branch. Your actual work is in a "messy state" and there are still more new feature changes need to be done on the projects coming up and don't want ...

Git File Lifecycle

Image
In this post, we will explore, experiment and see git basic files and folder -related commands if you are familiar with the Linux file system this will be easy for you! But, again no need to worry about that we will see every command execution with experiments. Every software product/server Lifecycle can be visible with their STATUS output, where they are currently if you know then you can move to different Lifecycle state. Let's understand how this navigation happens on the Git repository. Git File lifecycle status changes with commands Git Status Git Status will always compare the files and folders with the indexed with untracked files and display their status.  Syntax: git status [options] This command will check the status of the current branch by comparing it with the master branch Example: git status -s This `git status` command will show the working tree status. and it is having multiple useful options. When you use the -s or --short option it will display the...

Git branching - local and remote

Image
Hello all, in this post specially dedicated to all DevOps/DevSecOps Engineers.  Where their daily routine will have this commands if we know these we can play with them easily if you don't then it will be horrifies you!  Git Branching explained in detailed Prerequisites to this you should be aware git basics and to experiment with these command examples should have git installed on your Mac/Linux or git bash on Windows system. What is the Branch in Git? A Git branch is a separate line of work, where your work will not disturb other DevOps team members work. Branch is a simply a movable  pointer to commit, this we can observe using git branch command output wherever you see that '*' prefixed there the pointer pointing. Default branch is master or main (new trend) but it is optional we can name anything when we initiate the git repository. Main branch is the FIRST branch of your project that means once you run the 'git init' then 'git branch' you can observe t...

Comparing file changes with git diff command

Image
Hello Guys, in this post we will explore about git diff command options when to use what option etc. Git basic work flow is going happen initially starts at work area. When you add the files then it will be in the stage area. Once you feel everything is good then we will commit those changes then it will goes to local repository area. In simple words we can say work area -> stage area -> repo area.   The pictorial representation of my understanding about the git workflow: Work flow for git diff command exeuction   How to Compare files in git to get the last changes? In git we have this nice feature to compare a file what has been changed who did the changes we can track them with the inputs we can pass as options to the 'git diff' command. Syntax: git diff [code-file] Examples: You can compare and see all the files which are changed with the last commit. git diff You can compare and see specific file, for example we consider index.html file recently modified and ...

Git log - commit history

Image
Here is the GitOps story! we started learning more depth of every GIT commit history using git CLI. In this post, we have touched some rea-time scenario-based question and answers with practical examples which are useful for other DevOps team members.  The best question to help release management - who worked on the critical program/script which is in the release process? This can be found using the git log command.  The most interesting story if someone left the company and need to know what he did in his last commit. Tracking changes all of them done by that particular user.  The git log having many options: sorting filtering output formatting Let's see in detail by with experimenting each with an example. How to get the git log in a "Sorting order"? Here we have a couple of sorted commit history commands.  Using the --pretty value with  Oneline to going to give you the log output in simplify format. git log --pretty=oneline The output combination of ...