Create git commits in OneDrive-synced repositories by bypassing mmap errors using git plumbing commands. Use when git commit fails with "fatal mmap failed Invalid argument" error in OneDrive folders.
Creates git commits in OneDrive-synced repositories using plumbing commands to bypass mmap errors.
/plugin marketplace add theflysurfer/claude-skills-marketplace/plugin install theflysurfer-claude-skills-marketplace@theflysurfer/claude-skills-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Git repositories stored in OneDrive folders often fail with fatal: mmap failed: Invalid argument when executing porcelain commands like git commit, git status, or git push.
This occurs because OneDrive's file system layer interferes with git's memory-mapped file operations.
Use git plumbing commands to bypass the mmap issue and create commits manually.
Invoke this skill when:
/c/Users/*/OneDrive/)fatal: mmap failed: Invalid argumentgit commit fails repeatedlyReduce memory usage to minimize mmap calls:
cd "$REPO_PATH"
git config core.packedGitWindowSize 1m
git config core.packedGitLimit 1m
git config pack.windowMemory 1m
git config pack.packSizeLimit 1m
For each file to commit, create a blob object:
git hash-object -w path/to/file1
git hash-object -w path/to/file2
# Save the SHA hashes returned
Register each file in the index with its SHA:
git update-index --add --cacheinfo 100644,<SHA>,path/to/file1
git update-index --add --cacheinfo 100644,<SHA>,path/to/file2
Mode codes:
100644 = regular file100755 = executable file120000 = symbolic linkGenerate tree from current index:
TREE_SHA=$(git write-tree)
echo $TREE_SHA
Retrieve current HEAD SHA:
PARENT_SHA=$(git rev-parse HEAD)
echo $PARENT_SHA
Build commit with message and metadata:
COMMIT_MESSAGE="feat: Your commit message here
Detailed description if needed
Co-Authored-By: Claude <noreply@anthropic.com>"
COMMIT_SHA=$(echo "$COMMIT_MESSAGE" | git commit-tree $TREE_SHA -p $PARENT_SHA)
echo $COMMIT_SHA
Move HEAD to new commit:
git update-ref refs/heads/master $COMMIT_SHA
Replace master with current branch name if different.
Check commit was created:
git log -1 --oneline
If remote is configured:
git remote -v
git push origin master
Note: Push may also fail with mmap error. If so, user must push via Git GUI or GitHub Desktop.
If plumbing commands fail, recommend:
These tools don't use mmap and work reliably on OneDrive.
hash-objectgit rev-parse HEAD to get valid parent commit-p $PARENT_SHA from commit-treecd "$REPO_PATH"
# Configure memory
git config core.packedGitWindowSize 1m
# Create objects
SHA1=$(git hash-object -w file1.txt)
SHA2=$(git hash-object -w file2.txt)
# Update index
git update-index --add --cacheinfo 100644,$SHA1,file1.txt
git update-index --add --cacheinfo 100644,$SHA2,file2.txt
# Create tree
TREE=$(git write-tree)
# Get parent
PARENT=$(git rev-parse HEAD)
# Create commit
COMMIT=$(echo "feat: Update files" | git commit-tree $TREE -p $PARENT)
# Update branch
git update-ref refs/heads/master $COMMIT
# Verify
git log -1 --oneline
Commit is successful when:
git log -1 shows new commitLast Updated: November 2025 Tested On: Windows 11, Git 2.43+, OneDrive sync enabled
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.