Skip to main content

26 posts tagged with "git"

git tag description

View All Tags

Enable "Last Updated" Docusaurus Dates on Vercel

5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Docusaurus provides a powerful feature that displays the last updated time and last updated author for every blog post and documentation page. However, when deploying a Docusaurus website on Vercel, many developers encounter the same confusing issue:

Every page shows the exact same "last updated" date - or no date at all.

This guide explains precisely why this happens and the exact configuration you must enable on Vercel to make Docusaurus timestamps work correctly.

Git Detected Dubious Ownership in Repository Error

6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

The Git error message "detected dubious ownership in repository" is a modern security feature introduced in Git version 2.35.2 (and backported to several older versions) [1].

This error occurs when you attempt to run Git commands (like git status, git pull, or git commit) inside a repository whose files are owned by a different user ID (UID) than the one currently executing the Git command.

The primary purpose is to prevent privilege escalation or arbitrary code execution when working on shared systems or filesystems that allow one user to create a malicious .git/hooks file that another user (especially one with higher privileges) might unknowingly execute [2].

Check history of specific line in vscode

4 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

You can check the history of a specific line in VS Code using the built-in Git Blame feature or the Timeline view. For a much more powerful experience, the free GitLens extension is highly recommended.

How to squash commits

6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Squashing commits is a common Git operation that combines multiple commits into a single, cleaner commit. This is crucial for keeping your branch history tidy before merging into a main branch (like main or master), making the project history easier to read and revert [1].

The primary tool for squashing commits is interactive rebase (git rebase -i).

The Detached HEAD State: Why Git Won't Push and How to Fix It

6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Have you made changes in your repository only to realize git push fails because you are in a Detached HEAD state? This happens because when you run git checkout <commit-hash>, you are telling Git to look at a specific point in history, not a moving branch name.

In this state, any new commits you make are not part of any branch, making them very easy to lose. The solution is to create a new branch at that commit to save your work.

Git: Discard All Local Changes and Pull the Latest Remote Version

6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

To discard all your local changes and pull the latest version from a GitHub repository, you need to completely reset your local branch to match the remote's state. This process removes all uncommitted and committed local changes.

This guide covers the most reliable methods, including situations where you want to preserve specific local files like .gitignore or clean up untracked files.

Ultimate pre-commit Configuration for Python: Complete setup & Advanced practices

8 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Maintaining code consistency and preventing quality regressions across a development team can be challenging. Manually checking styles or reminding teammates about formatting imports leads to cognitive overhead and code reviews cluttered with style arguments.

By implementing pre-commit, you can automate code formatting, import sorting, stylistic linting, and static type checking directly into your Git commit lifecycle. This guide outlines the ultimate pre-commit configuration for Python, demonstrates how to centralize settings, and provides advanced optimization tips.

Git error: 'main/' does not have a commit checked out`

4 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

The error error: 'main/' does not have a commit checked out occurs when Git tries to add files to a submodule that is in a detached HEAD state or has no checked-out commit. This happens because the main repository expects the submodule to point to a specific commit, but it's in an invalid state.

To fix this, you need to navigate into the submodule's directory and check out a commit, usually by switching to the main branch or a specific branch.

Save username and password in Git

4 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

To save your username and password in Git, you can configure a credential helper. A credential helper is a Git component that securely stores your authentication information in memory or on disk, so you don't have to enter it every time you interact with a remote repository.

Fix 'Write access to repository not granted' in Git/GitHub

6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

The fatal: unable to access error with the message "Write access to repository not granted" typically means you don't have the necessary permissions to push changes to the GitHub repository. It's a clear signal from the server that your authentication credentials, while valid, don't grant you the required write access.

Here's how to diagnose and solve this issue: