obsidian-git-repo-sync
Skill48 starsChanged 4 months agoMITView on GitHub
Sync a local directory to a GitHub remote repository. This skill should be used when the user wants to push/sync/upload their current project directory to a GitHub repository. Triggered by requests like "同步到远程仓库", "推送到GitHub", "上传到仓库", "sync to GitHub", or "push to remote".
- Reads credentials
- Installs packages
- Commits and pushes
In this repository5 other files it gives its agents.
- html-planSkill
- novel-writerSkill
- qimao-novel-scraperSkill
- weibo-hot-scraperSkill
- zhihu-hot-scraperSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 8 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Check whether git is installed on the system by running:
- Distinctive: line 32
Wait for the user to provide the URL before proceeding.
- Distinctive: line 36
After receiving the URL, execute the following steps using the current workspace directory:
- Very specific: line 44
If the directory is already a git repository (.git exists), skip this step.
- Distinctive: line 48
Check existing remotes first:
- Very specific: line 53
If origin does not exist, add it:
- Very specific: line 58
If origin already exists but points to a different URL, update it:
- Distinctive: line 70
If there are no changes to commit, skip this step.
- Distinctive: line 79
If the push fails, check the error message:
- Distinctive: line 81
Remote not found: Verify the URL is correct with the user.
- Distinctive: line 82
Remote has existing commits: Use git pull origin main --allow-unrelated-histories --no-rebase first to merge, then commit and push again.
- Very specific: line 94
Always use the workspace root directory (.) as the working directory for all git commands.
- Very specific: line 95
If there's a .gitignore file already present, it will be respected.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Obsidian Git Repo Sync
Overview
Initialize a local directory as a git repository and push all contents to a specified GitHub remote. The skill guides the process step by step, starting with an environment check and then collecting the remote URL from the user.
Workflow
Step 1: Check Git Installation
Check whether git is installed on the system by running:
git --version- If the command succeeds → proceed to Step 2.
- If the command fails (git not found) → tell the user: "Git is not installed on this machine. Please install Git first from https://git-scm.com/ or use your system package manager (e.g.,
brew install giton macOS). Once installed, let me know and I'll continue." Stop here and wait for the user.
Step 2: Ask for the Remote Repository URL
Once git is confirmed installed, ask the user:
"What is your GitHub remote repository URL? (e.g.,
https://github.com/username/repo.git)"
Wait for the user to provide the URL before proceeding.
Step 3: Sync the Directory to the Remote
After receiving the URL, execute the following steps using the current workspace directory:
Initialize git (if not already a repository):
git initIf the directory is already a git repository (
.gitexists), skip this step.Add the remote (if not already configured):
Check existing remotes first:
git remote -vIf
origindoes not exist, add it:git remote add origin <REMOTE_URL>If
originalready exists but points to a different URL, update it:git remote set-url origin <REMOTE_URL>Stage and commit all files:
git add -A git commit -m "Initial commit"If there are no changes to commit, skip this step.
Push to remote:
git branch -M main git push -u origin mainIf the push fails, check the error message:
- Authentication failure: Tell the user to configure git credentials (e.g., using a Personal Access Token or SSH key) and retry.
- Remote not found: Verify the URL is correct with the user.
- Remote has existing commits: Use
git pull origin main --allow-unrelated-histories --no-rebasefirst to merge, then commit and push again.
Step 4: Report the Result
Tell the user what was pushed:
- The remote URL
- The branch name (main)
- How many files were committed
- A reminder: "Your local branch is now tracking
origin/main. Future pushes can be done withgit pushdirectly."
Notes
- Always use the workspace root directory (
.) as the working directory for all git commands. - If there's a
.gitignorefile already present, it will be respected. If not, suggest creating one if there are files the user might not want to sync (e.g.,.obsidian/,node_modules/,.env).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

