详解 Git 重置(Reset)操作:硬重置、软重置与混合重置 详解 Git Reset Operations: Hard, Soft, and Mixed Resets

In Git, "Reset" is used to undo or modify commit history by adjusting branch pointers and the state of the working directory/staging area. Beginners often make mistakes due to confusion about the different types. The following outlines the three common types and their core distinctions: **Soft Reset (--soft)** Only moves the HEAD pointer while preserving the working directory and staging area. Useful for modifying commit messages or re-staging changes for re-commit (e.g., `git reset --soft HEAD~1`). **Mixed Reset (default --mixed)** Moves the HEAD and resets the staging area, but retains the working directory. Ideal for undoing commits and reorganizing changes before re-committing (no parameters needed by default). **Hard Reset (--hard)** Moves the HEAD and completely resets the staging area and working directory, permanently discarding all modifications. Use only when certain changes are unnecessary (e.g., `git reset --hard HEAD~1`), as this operation is irreversible. **Key Distinctions**: - Reset modifies local commit history (suitable for unshared changes). - Revert creates new commits (use when changes have been pushed). - Hard reset requires caution: always confirm status with `git status` before use. Unbacked-up changes can sometimes be recovered via `reflog` (only applicable for unshared local commits). **Summary**: - Soft reset is lightweight for modifying history. - Mixed reset is the default and most commonly used. - Hard reset is dangerous and requires careful verification.

Read More
Synchronizing Git Remote Branches: How to Pull the Latest Remote Branches and Update Local Repository

In a Git project with multi - person collaboration, syncing remote branches is to ensure that the local code is in line with the latest progress of the remote repository and avoid conflicts or missing new features. The core steps are as follows: First, ensure that the local repository is connected to the remote. Use `git remote -v` to check. If not connected, add it with `git remote add origin <address>`. Then check the branch status: remote branches with `git branch -r` and local branches with `git branch`. There are two methods to pull updates: Method 1 is `git pull` (the most commonly used), which directly pulls and merges the remote branch into the current branch. The steps are: switch to the target branch (e.g., `git checkout dev`), then execute `git pull origin dev`; Method 2 is `git fetch` + `merge`, first pull the updates (`git fetch origin dev`), then merge (`git merge origin/dev`), which is suitable for scenarios where you need to confirm the update content. If there is a conflict during pulling, Git will mark the conflicted files (such as `<<<<<<< HEAD` and others). You need to manually edit the files to delete the markers, then use `git add <file>` and `git commit` to resolve the conflict. Common issues: When there are uncommitted modifications causing conflicts, use `git stash` to temporarily store the changes before pulling; when there is no remote branch locally, use `

Read More
Git Version Comparison: Practical Tips for Viewing Code Changes with the diff Command

The `git diff` command in Git is used to view code changes between versions, a fundamental and practical tool. It can compare differences between the working directory and the staging area, the staging area and historical commits, historical versions, and different branches. Core scenarios and corresponding commands are as follows: `git diff <filename>` for comparing the working directory with the staging area; `git diff --staged` for comparing the staging area with historical commits; `git diff <hash1> <hash2>` for comparing historical versions; and `git diff <branch1> <branch2>` for comparing different branches. Useful parameters include: `-w` to ignore whitespace changes, `--name-only` to only display filenames, `--stat` to show line modification statistics, and `--binary` to compare binary files. In the output, `+` indicates added content and `-` indicates deleted content. Mastering `diff` enables efficient management of code changes and helps avoid accidental commits.

Read More
A Guide to Git Submodules: Managing Dependent Code in Projects

Git submodules are tools for reusing independent code (such as common libraries) in large projects, solving problems like duplicate copying and version synchronization. Core advantages include: space savings through code reuse, independent maintenance for easy modification and submission, and version specification by the main project to ensure consistency. Essentially, submodules are independent Git repositories, with the main project recording configurations and version references via .gitmodules and .git/config. Core usage steps: Add submodules to the main project using `git submodule add`; clone projects with submodules using `--recursive`, otherwise use `init+update`; commit main project references after modifying submodules; update with `git submodule update`; clean configurations when deleting submodules. Common issues: Empty repositories after cloning (supplement with `--recursive` or `update`), unupdated main project after submodule modifications (supplement with commits), version conflicts (agree on branches). Summary: Suitable for independently reusable dependencies, following the process: add → clone/update → modify and commit → update main project references, improving maintenance efficiency.

Read More
Git and CI/CD: Implementing Automated Deployment and Testing with Git

This article introduces the core concepts of Git and CI/CD and their combined application. Git is a version control tool, like a "code diary," which records modifications, manages collaboration, and avoids conflicts and version chaos. CI/CD (Continuous Integration/Continuous Delivery/Deployment) replaces manual processes with automation, enabling automatic testing and deployment after code submission to improve efficiency. The combination of the two is a "golden partnership": developers commit code to a Git repository, and CI/CD tools automatically trigger processes such as testing, building, and deployment (e.g., deploying a frontend project to Netlify using GitHub Actions). The combined advantages are significant: reducing errors (through automated testing), accelerating iteration (completing the entire process in minutes), lowering costs (reducing manual labor), and facilitating traceability (enabling checks on deployment sources). Git lays the foundation for version management, while CI/CD enables process automation. Their combination transforms development from manual to smooth, making it an essential skill in modern development.

Read More
Git Common Commands Quick Reference: Remember These 10 Commands, Git Operations Will Be Easy

This article introduces 10 core and commonly used Git commands to help beginners quickly master basic operations. The core commands cover the complete workflow from initialization to collaboration: - **Initialization/Clone**: `git init` initializes a local repository, and `git clone` copies code from a remote repository; - **Modify and Commit**: `git add` stages changes (use `.` for a single file or entire directory), and `git commit -m "message"` commits to the local repository (with clear commit messages); - **Status and History**: `git status` checks repository status, and `git log` views commit history (`--oneline` for a concise format); - **Branch Management**: `git checkout -b branch-name` creates and switches to a branch, and `git merge branch-name` merges branches (note conflict handling); - **Collaboration Operations**: `git pull` fetches and merges remote code, and `git push origin branch-name` pushes a local branch to the remote. The core workflow is: Initialize/Clone → Stage modifications (add) → Commit → Branch management → Collaboration (pull/push). Beginners can gradually become proficient through practice, reducing version management chaos.

Read More
Git Repository Cleanup: Methods to Delete Unused Local and Remote Branches

The article introduces the necessity, steps, and precautions for cleaning up useless Git branches. Necessity: reducing repository clutter, lowering the risk of accidental deletion, and saving storage space. Before cleaning, confirm permissions, check branch status (whether merged), and back up important branches. For local deletion: First, list branches with `git branch --merged main_branch` to filter merged branches. After confirmation, delete merged branches with `git branch -d branch_name`, and use `-D` for unmerged branches (high risk). For remote deletion: Directly delete remote branches with `git push origin --delete branch_name`, or use `git fetch -p` to clean up locally tracked remote obsolete branches. Advanced tips: Batch delete merged branches locally using `git branch --merged master | grep -v '^\*\|master\|main' | xargs git branch -d`, and similar looping commands for remote branches. Precautions: Confirm if branches are in use by others, avoid deleting unmerged branches by mistake, and note that recovery is difficult after deletion. When regularly cleaning, confirm status first to ensure safety and efficiency.

Read More
Collaborative Git for Multiple Users: A Collaborative Workflow to Resolve Team Code Conflicts

In collaborative software development with Git, conflicts can arise when multiple developers modify the same part of a file simultaneously, which is an inevitable磨合 issue in teamwork. However, with the right workflow, these conflicts can be effectively managed. Conflicts typically occur when key sections of a file are modified by multiple people (e.g., two developers changing the greeting message and variable names in the `greet()` function simultaneously). The resolution process involves 5 steps: 1. Synchronize with the remote repository using `git pull` before collaboration. 2. When conflicts are triggered, Git will notify you; use `git status` to identify the conflicting files. 3. Open the file to view conflict markers: `<<<<<<< HEAD` (local code) and `>>>>>>> branch-name` (remote code). 4. Manually remove these markers and merge the content based on business logic. 5. After resolution, use `git add` to stage the file and `git commit` to finalize the merge. Preventive measures include: - Small, focused commits (each commit addressing one functional change). - Frequent synchronization (pulling code daily before starting work). - Clear task division (avoiding concurrent modifications to the same module). The core principle is "prevention first, manual judgment, and verification after resolution." Git provides the necessary tools, but conflict handling requires effective team communication and collaboration.

Read More
Pitfalls in Git Staging Area: How to Undo Accidental `add` of Files?

When an unintended file (e.g., temporary files) is added to the staging area using `git add`, it can be undone with `git reset`. The staging area acts as a temporary中转站 (transit station), where `git add` copies snapshots of files from the working directory. It is essential to understand its relationship with the working directory and the local repository (HEAD). Core command: `git reset HEAD <filename>` reverts the specified file version in the staging area to match the local repository (undoing the `git add` for that file), while preserving the working directory content. If `git add .` was mistakenly executed, use `git reset HEAD` to undo all staged files. To remove incorrect content from the working directory, `git checkout -- <filename>` can restore it to the staging area or the most recent commit version. Key distinction: `reset` only undoes staging area operations, while `checkout` restores working directory content. Remember: Use `git reset HEAD <filename>` (for individual files) or `git reset HEAD` (for all files) to undo staging. `checkout` may be necessary to handle working directory changes when required.

Read More
Git Commit Message Specification: 3 Benefits of Standardizing Commit Messages

This article introduces the importance of standardizing commit messages, which has three benefits: first, it ensures clear version history; standardized descriptions (e.g., "fix: resolve login password prompt issue") enable quick location of changes and avoid inefficient debugging caused by ambiguous wording. Second, it facilitates smooth team collaboration; a unified format (e.g., "feat: add registration form validation") clarifies the purpose of each commit and reduces communication costs. Third, it simplifies the automatic generation of change logs; tools can categorize and count commits based on standardized information (e.g., "feat" and "fix") to produce clear version update records (e.g., generating CHANGELOG with standard-version), thereby improving release efficiency. Although standardizing commit messages requires developing a habit, it leads to more efficient version management, collaboration, and release in the long run.

Read More
Git Version Control: Why Is Git Considered a Standard Tool for Modern Software Development?

Version control tools such as Git are central to modern software development, addressing issues of code change tracking, collaboration, and rollback. Git has become a standard due to its key advantages: its distributed architecture ensures a complete local repository, enabling most operations to be performed offline and enhancing flexibility; branch functionality supports parallel development, with main and development branches acting like independent drafts that do not interfere with each other; commit snapshots record timestamps of every modification, allowing for easy rollback at any time; and its lightweight, efficient design enables quick operations through differential comparisons, ensuring smooth local performance. Additionally, the mature Git ecosystem features widespread industry adoption, abundant open-source resources, and strong tool compatibility. Mastering Git resolves problems such as collaborative chaos, difficult rollbacks, and inefficient parallel development, making it a "must-have" skill for modern software development.

Read More
Git Repository Clone Failed? Troubleshooting "fatal: unable to access" Errors

`fatal: unable to access` errors are common and caused by network issues, incorrect addresses, permission problems, proxy settings, or cached credentials. Troubleshoot using the following steps: 1. **Network Check**: Use `ping` to test connectivity to the repository domain name. Switch to a public repository or mobile hotspot to confirm network availability. 2. **Address Verification**: Re-copy the repository address (distinguish between HTTPS/SSH) and paste it into a browser to verify accessibility. 3. **Permission Issues**: Private repositories require authentication. For HTTPS, enter account credentials (or configure credential caching); for SSH, ensure SSH keys are pre-configured. 4. **Proxy Configuration**: In internal networks, check proxy settings and configure `http/https` or `socks5` proxy addresses or disable proxies if unnecessary. 5. **Clear Cache**: Remove outdated credential caches and reset `credential.helper` to avoid repeated incorrect input prompts. Following these steps will resolve 90% of cloning failures. If issues persist, contact your administrator or upgrade Git before retrying.

Read More
Git Branching Strategies: Choosing and Applying GitHub Flow vs. Git Flow

Branch strategies address code conflicts and version management issues in multi-person collaboration, enabling more organized teamwork. The mainstream strategies are GitHub Flow and Git Flow. GitHub Flow is minimalist and flexible, with only two branches: `main` (the main branch) and temporary branches (e.g., `feature/xxx`). The process is straightforward: create a temporary branch from `main`, make modifications, and merge back to `main` via a Pull Request (PR), supporting continuous deployment. Its advantages include simplicity, efficiency, and rapid iteration, making it suitable for personal projects or scenarios requiring quick updates. However, it lacks version planning and is unsuitable for complex version management. Git Flow has clear division of labor with five branches: `main`, `develop`, `feature`, `release`, and `hotfix`. The process is strict, with fixed responsibilities for each branch and phases such as development, testing, and release. It excels in standardization, orderliness, and risk control, making it ideal for large teams or long-term maintenance projects. On the downside, it has a high learning curve and slower iteration speed. Selection recommendations: Choose GitHub Flow for small teams and fast-paced projects; select Git Flow for large teams or projects requiring version management. The core is to ensure smooth collaboration without sacrificing efficiency.

Read More
Must-Do Before Git Commits: Check Changes, Stage, and Commit Message

### The "Golden Three Steps" Before Git Commit Before committing code, you need to verify the changes to avoid accidentally committing sensitive information or incomplete code. The core steps are as follows: **1. Check Changes** Use `git status` to view the project status, distinguishing between "modified but unstaged" and "untracked files." Use `git diff <file>` to check specific modifications (e.g., added/deleted lines), and avoid committing irrelevant content like temporary comments or debug logs. **2. Stage Changes** Use `git add` to stage files for commit. For a single file, use `git add <file>`; for all changes, use `git add .` (proceed with caution to avoid adding unintended files). If staging is incorrect, use `git reset HEAD <file>` to undo. **3. Write Clear Commit Messages** Before using `git commit`, clearly describe the purpose of the changes. For short messages, use `-m "description"` (e.g., "Optimize homepage title"). For complex content, open the text editor (default Vim) to write multi-line messages, ensuring conciseness and meaningfulness. Developing the habit of "checking - staging - writing messages" can prevent error - prone commits and improve team collaboration efficiency.

Read More
Git Newbies' Pitfall Guide: These Basic Operation Mistakes You Must Know

This article summarizes common basic mistakes made by Git beginners and their solutions to help them avoid pitfalls quickly. Common mistakes in repository operations include: repeatedly executing `git init` (which overwrites configurations and causes confusion; only execute it once), and entering the wrong clone address (copy the platform address to avoid manual input). For file staging and committing: omitting or adding extra files with `git add` (specify filenames or use `git status` to confirm), not checking the status before committing (always run `git status` first), and providing vague commit messages (e.g., empty messages or "changed something"; use clear descriptions like "fixed button misalignment"). In branch operations: failing to stash changes before switching branches (use `git stash` or `commit`), merging the wrong branch (confirm the current branch), and deleting the current branch (switch branches first). Regarding pull and push: confusing `pull` and `fetch` (fetch first, then merge), not pulling before pushing (pull first to avoid overwrites), and insufficient permissions (check the address and SSH keys). For version rollbacks: mistakenly using `--hard` without stashing (stash first and use `reflog` to restore), and recovering after rollback (check `reflog` for version numbers). In conflict resolution: failing to remove conflict markers or deleting content randomly (retain content and remove only markers).

Read More
Diagram of Common Git Operations: Complete Steps from Clone to Commit

This article introduces the basic operation process for Git beginners from cloning a repository to committing modifications. First, clarify three core areas: the working directory (unmanaged modified files), the staging area (a temporary storage area for commits), and the local repository (permanently records commit history). The process includes: 1. Cloning a remote repository (`git clone <URL>`); 2. Entering the directory and checking status (`git status`); 3. Modifying files (working directory operations); 4. Staging modifications (`git add [filename]` or `git add .`); 5. Committing to the local repository (`git commit -m "message"`); 6. Viewing commit history (`git log`); 7. Pushing to the remote repository (`git push origin [branch]`). A quick-reference cheat sheet for key commands summarizes core operations, emphasizing that Git enables collaboration and version management by tracking changes, with regular practice allowing rapid mastery of the basic workflow.

Read More
Git Distributed Version Control: Why Every Developer Needs a Local Repository

This article introduces the importance of local repositories in the Git version control system. Version control can record code modifications and avoid chaos. As a distributed tool, Git differs from centralized systems like SVN with its "central server" model, as each developer maintains a complete local code repository. A local repository is the `.git` directory on a computer, with core functions: it is offline-accessible, allowing commits and branch operations without an internet connection; it supports experimentation by safely testing new features in local branches; and it ensures data security by automatically backing up all modifications, preventing code loss due to server failures or power outages. Its value lies in: independence from the network, enabling more flexible work (e.g., writing code without internet access on the subway); preventing accidents, as rollbacks can be performed via commands like `git reset`; and enhancing collaboration efficiency by allowing local completion of features before pushing to the remote repository. The local repository is the core of Git's distribution model, and developers should attach importance to it (e.g., initializing with `git init`), as it is crucial for ensuring development flexibility and reliability.

Read More
Git Version Rollback: A Secure Method to Recover Code from Erroneous Commits

In Git version control, if incorrect code is committed, you can revert to a previous version to recover. First, use `git log --oneline` to view the commit history and obtain the target version's hash value. The core methods for reverting are divided into three scenarios: 1. **Undo the most recent incorrect commit**: Use `git reset --soft HEAD~1`. This only reverts the commit record while preserving changes in the staging area and working directory, allowing re - submission. 2. **Revert to a specific version**: Use `git reset --hard <target - hash - value>`. This completely reverts the version and discards subsequent modifications (ensure no important unsaved content exists before operation). 3. **Revert errors that have been pushed to the remote**: First, revert locally, then use `git push -f` to force - push. This requires confirming there is no collaboration among the team. For collaborative work, the `revert` command is recommended. **Notes**: Distinguish between `--soft` (preserves modifications), `--hard` (discards modifications), and `--mixed` (default). For uncommitted modifications, use `git stash` to temporarily store and then recover them. Forcing a push to the remote is risky and should be avoided in branches with multiple team members collaborating. The key is to confirm the version, select the correct parameters, and operate remotely cautiously to safely revert from errors.

Read More
Best Practices for Git Branch Merging: 5 Practical Tips to Reduce Conflicts

This article shares 5 tips to reduce Git branch merge conflicts: 1. **Clear branch responsibilities**: Assign specific roles to branches, e.g., `main` for stable code, `feature/*` for new features, `bugfix/*` for production issues, etc., to avoid overlapping merge scopes. 2. **Small, incremental commits**: Split tasks into minimal changes. Each commit should modify only a small amount of code, reducing merge differences and making auto-resolution of conflicts easier. 3. **Frequent main branch synchronization**: Pull the latest code from the main branch daily (`git merge` or `rebase`) to keep feature branches aligned with `main` and prevent divergence. 4. **Use `rebase` to organize commits**: "Replay" local commits onto the latest main branch code to maintain a linear commit history and minimize divergent conflicts (only applicable to branches not yet pushed to remote). 5. **Resolve conflicts correctly**: Understand the `<<<<<<<`, `=======`, and `>>>>>>>` markers. Modify code and remove markers; consult colleagues if unsure. **Core principles**: Clear responsibilities, small commits, frequent synchronization, clean history, and proper conflict resolution can significantly reduce merge conflicts.

Read More
The Distinction Between Git's Staging Area and Working Directory: The Reason for `add` Before `commit`

This article introduces the core concepts, differences, and functions of the working directory and staging area in Git. The working directory consists of files that can be directly operated on locally (like a draft paper), while the staging area is an internal intermediate repository within Git (like a pending review express box). The key differences between them are as follows: location (the working directory is the local file system, while the staging area is internal to Git), editing methods (the working directory can be modified directly, while the staging area requires changes via commands), Git tracking status (the working directory is untracked, while the staging area is marked for commit), and visibility (modifications in the working directory are directly visible, while the staging area is only visible to Git). The process of "add before commit" is mandatory because the staging area allows for more selective commits: skipping the staging area and directly committing would cause Git to submit all changes in the working directory, potentially leading to accidental commits of incomplete work. By following the workflow of "modify → git status → git add → git commit", developers can achieve staged commits. As a buffer zone, the staging area helps developers flexibly control the scope of commits, preventing drafts or incomplete content from being accidentally committed and making code management more controllable.

Read More
Git Remote Repository Connection: A Comparison of Advantages and Disadvantages of HTTPS vs. SSH

Git commonly uses two methods to connect to remote repositories: HTTPS and SSH. HTTPS is based on HTTP encryption and uses account password authentication. Its advantages are simplicity, ease of use, and good network compatibility, making it suitable for temporary access, public networks, or first-time use. However, it requires repeated password input and relies on password storage security. SSH is based on an encryption protocol and uses key pairs (public key + private key) for authentication. It offers advantages like password-free operations and high security, making it ideal for long-term projects with frequent operations (such as private repositories or internal company projects). On the downside, SSH configuration is slightly more complex (requiring key pair generation and addition to the remote repository), and the default 22 port may be restricted by firewalls. For applicable scenarios: HTTPS is recommended for temporary access and public networks, while SSH is better for long-term projects and frequent operations. Choosing the right method based on the scenario can enhance efficiency and security.

Read More
Git Tags and Version Releases: Methods for Marking Important Project Milestones

Git tags are a tool that Git uses to create "snapshots" for specific commits. They can mark project milestones (such as version releases), facilitating version location, rollback, and team collaboration. Tags are categorized into annotated tags (recommended for formal versions, created with the -a -m parameters and a description) and lightweight tags (for quick marking without a description). Usage process: Creating tags (local and remote push), viewing (git tag), and deleting (local with git tag -d, remote via git push origin --delete). Version releases follow semantic versioning (major.minor.patch), with tags applied after stable versions, milestones, or urgent fixes. Tags are static snapshots, distinct from dynamic branches (e.g., master), enabling quick rollbacks to historical versions. Mastering tag operations and following a standardized version numbering system can enhance project management efficiency.

Read More
Git Conflicts Explained: Why Do They Occur? How to Resolve Them Quickly?

Git conflicts are a common issue in collaborative work. When different versions modify the same file at the same location, Git cannot merge them automatically, requiring manual resolution. The core reason for conflicts is "modifications at the same location", such as multiple people editing the same file, version differences during branch merging, or conflicts between deletion and addition of content. Resolving conflicts involves three steps: First, after detecting a conflict, open the file and identify the markers automatically added by Git (`<<<<<<< HEAD` (your changes), `=======` (separator), `>>>>>>> branch-name` (changes from others)). Second, edit the content between the markers, choosing to retain or merge both parties' modifications. Third, execute `git add` to mark the conflict as resolved, then use `git merge --continue` or `git pull --continue` to complete the operation. Tools like VS Code can help quickly resolve complex conflicts. To prevent conflicts, develop habits such as frequently pulling code, committing in small steps, collaborative division of labor, and communication in advance. Remember the three-step process "identify markers → modify content → mark as resolved" to easily handle Git conflicts.

Read More
Git Fetch vs Pull: Differences and Usage Scenarios

In Git, `fetch` and `pull` are commonly used commands to pull remote code. The core difference lies in whether they automatically merge, provided that you understand "remote tracking branches" (mirrors of remote branches on the local machine). - **`git fetch`**: Only pulls remote updates to the local remote tracking branches (e.g., `origin/master`) without automatic merging. You must manually execute `git merge`. It is suitable for first reviewing remote updates before deciding whether to merge and will not affect the local working directory. - **`git pull`**: Essentially combines `fetch` with an automatic `merge`. After pulling, it directly merges the changes into the current branch, which may require manual resolution of code conflicts. It is suitable for scenarios where immediate synchronization with remote updates is needed, but may overwrite uncommitted local modifications. **Core Difference**: `fetch` is flexible (review before merging), while `pull` is efficient (pull and merge immediately). Choose based on whether automatic merging is required to avoid issues caused by conflicts or uncommitted modifications.

Read More
Pushing Code to Remote Repository with Git: How to Push Local Branches to GitHub/GitLab

The purpose of pushing code to a remote repository is to enable team collaboration, code backup, or hosting on remote platforms (such as GitHub/GitLab). The core processes and key points are as follows: **Preparation**: Ensure there are committed modifications in the local repository (`git add .` + `git commit -m "description"`), and the remote repository is already associated (default `origin`, established during cloning). **Push Commands**: - **First Push**: Specify the remote repository and branch using the syntax `git push [remote-repo-name] [local-branch-name]:[remote-branch-name]`, e.g., `git push -u origin dev` (`-u` automatically associates the branch for subsequent simplification). - **Subsequent Pushes**: If the branch is already associated, simply use `git push`. When branch names differ, use `git push origin local-branch:remote-branch` (e.g., `feature:new-feature`). **Verification and Troubleshooting**: After pushing, check the remote platform's webpage. Common issues: - Conflict: Resolve conflicts after `git pull` and then push again; - Permission: Verify account/repository permissions or re-enter credentials; - Accidental Push: If not yet pulled, use `--force` (note: use with caution).

Read More