Showing posts with label developer. Show all posts
Showing posts with label developer. Show all posts

Monday 16 September 2024

How GitHub Advanced Security for Azure DevOps Saves the Day (and Your Reputation)

Let's face it, developers: we've all accidentally committed a secret (or two) to our code repository at some point. Maybe it was an API key, a database password, or that super-secret encryption key you swore you'd never forget. ‍♂️



The problem?  Those exposed secrets can be a hacker's dream come true. A leaked secret can bring your entire application crashing down, wreaking havoc on your data and reputation. Shuddersville.  Many good developers do not pay attention to this critical aspect while working on the code, behaviour which most of the time becomes very costly and painful.

That's where GitHub Advanced Security for Azure DevOps swoops in like a superhero with a cape (well, maybe more like a shield, but you get the idea). This powerful integration brings the muscle of GitHub's security features into your Azure DevOps workflow, so you can identify and squash those secret leaks before they become a disaster.


Here's how GitHub Advanced Security for Azure DevOps saves your bacon:

  • Secret Scanning: It acts like a super-sleuth, scouring your code for any exposed secrets like passwords, tokens, and keys. No more accidental oopsies making it past your commit.
  • Dependency Scanning: Those third-party libraries you love? They can have hidden vulnerabilities. Advanced Security scans your dependencies to expose any weak spots so you can patch them up before they get exploited.
  • CodeQL Code Scanning: This built-in code analysis tool is like a security X-ray for your codebase. It hunts for potential vulnerabilities and coding errors, so you can fix them before they become a problem.

The best part? This security suite integrates seamlessly into your Azure DevOps workflow. No need to jump through hoops or learn a whole new platform. You can find, fix, and prevent security issues all within your familiar Azure DevOps environment. Win-win!

So, ditch the stress of exposed secrets and vulnerable code. Embrace the power of GitHub Advanced Security for Azure DevOps. Your future self (and your security team) will thank you for it.

P.S. Looking for more info? Check out the official documentation to see how to get started with GitHub Advanced Security for Azure DevOps and start building more secure software today!

Saturday 18 May 2024

How do I force "git pull" to overwrite local files?

 There might be situations where you want to discard your local changes and synchronise your working directory with the latest version from the remote repository. While a regular git pull attempts to merge changes, it can prompt conflict resolution if the same file has been modified locally and remotely.



This article will guide you through two methods to force an overwrite of local files during a pull operation:

Method 1: Using git fetch and git reset

This approach involves two separate commands:

  1. git fetch --all: This fetches the latest changes from all remotes and branches but doesn't integrate them into your working directory.
  2. git reset --hard origin/<branch-name>: This resets your current branch to match the state of the remote branch specified by <branch-name> on the remote named "origin" (replace "origin" if your remote has a different name). The --hard flag discards any local changes you have.

Code Sampler:

Bash
git fetch --all
git reset --hard origin/master  # Replace "master" with your branch name

Method 2: Using git pull -f (Force)

While not recommended for regular use, git allows a forceful pull using the -f flag. This command fetches and integrates changes from the remote branch, discarding any local modifications and potentially causing data loss.

Code Sampler (Use with Caution!)

Bash
git pull -f origin/<branch-name>  # Replace "master" with your branch name

Important Considerations:

  • Both methods discard any uncommitted changes in your working directory.
  • Using git pull -f can lead to data loss if you haven't pushed your local commits.
  • It's recommended to back up your local repository before using these commands, especially git pull -f.

Alternatives:

  • If you want to preserve your local changes, consider stashing them before the pull using git stash --include-untracked and then applying them after the pull with git stash pop.
  • Rebasing your local branch on top of the remote branch can integrate changes while preserving your local commit history.

Conclusion

Forcing an overwrite of local files during a pull can be helpful in specific scenarios. However, it's crucial to understand the potential data loss and choose the method that best suits your situation. Remember to back up your work and prioritize preserving your commits whenever possible.

Obs: You can also consult this StackOverflow Git Guide 

Thursday 16 May 2024

What are the steps to remove a Git branch from both my local machine and the remote repository?

Many times, I found myself having to delete Git repositories as part of my daily duties. Following some of the documentation online, I tried many times getting frustrated ..




Failed Attempts to Delete a Remote Branch:

$ git branch -d remotes/origin/bugfix
error: branch 'remotes/origin/bugfix' not found.

$ git branch -d origin/bugfix
error: branch 'origin/bugfix' not found.

$ git branch -rd origin/bugfix
Deleted remote branch origin/bugfix (was 2a14ef7).

$ git push
Everything up-to-date

$ git pull
From github.com:gituser/gitproject

* [new branch] bugfix -> origin/bugfix
Already up-to-date.


How do I properly delete the remotes/origin/bugfix branch both locally and remotely?


How to check for open ports on Linux

Checking for open ports is among the first steps to secure your device. Listening services may be the entrance for attackers who may exploit...