agentleFS
YunshiroYunshiro/yunn-skills/skills/obsidian-git-repo-sync/SKILL.md

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

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
  1. Distinctive:

    Check whether git is installed on the system by running:

    line 17
  2. Distinctive:

    Wait for the user to provide the URL before proceeding.

    line 32
  3. Distinctive:

    After receiving the URL, execute the following steps using the current workspace directory:

    line 36
  4. Very specific:

    If the directory is already a git repository (.git exists), skip this step.

    line 44
  5. Distinctive:

    Check existing remotes first:

    line 48
  6. Very specific:

    If origin does not exist, add it:

    line 53
  7. Very specific:

    If origin already exists but points to a different URL, update it:

    line 58
  8. Distinctive:

    If there are no changes to commit, skip this step.

    line 70
  9. Distinctive:

    If the push fails, check the error message:

    line 79
  10. Distinctive:

    Remote not found: Verify the URL is correct with the user.

    line 81
  11. Distinctive:

    Remote has existing commits: Use git pull origin main --allow-unrelated-histories --no-rebase first to merge, then commit and push again.

    line 82
  12. Very specific:

    Always use the workspace root directory (.) as the working directory for all git commands.

    line 94
  13. Very specific:

    If there's a .gitignore file already present, it will be respected.

    line 95

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 git on 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:

  1. Initialize git (if not already a repository):

    git init

    If the directory is already a git repository (.git exists), skip this step.

  2. Add the remote (if not already configured):

    Check existing remotes first:

    git remote -v

    If origin does not exist, add it:

    git remote add origin <REMOTE_URL>

    If origin already exists but points to a different URL, update it:

    git remote set-url origin <REMOTE_URL>
  3. Stage and commit all files:

    git add -A
    git commit -m "Initial commit"

    If there are no changes to commit, skip this step.

  4. Push to remote:

    git branch -M main
    git push -u origin main

    If 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-rebase first 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 with git push directly."

Notes

  • Always use the workspace root directory (.) as the working directory for all git commands.
  • If there's a .gitignore file 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).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.