{"id":13456364,"url":"https://github.com/open-condo-software/gitexporter","last_synced_at":"2025-12-30T01:01:39.466Z","repository":{"id":40309850,"uuid":"434863873","full_name":"open-condo-software/gitexporter","owner":"open-condo-software","description":"Make some private GitHub repo directories public","archived":false,"fork":false,"pushed_at":"2024-03-12T14:32:46.000Z","size":146,"stargazers_count":77,"open_issues_count":7,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-01T14:48:29.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/open-condo-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-04T09:55:45.000Z","updated_at":"2024-09-29T06:28:34.000Z","dependencies_parsed_at":"2024-07-31T08:24:25.673Z","dependency_job_id":null,"html_url":"https://github.com/open-condo-software/gitexporter","commit_stats":{"total_commits":48,"total_committers":4,"mean_commits":12.0,"dds":"0.14583333333333337","last_synced_commit":"f950ce7c6041d4a897128ac290c3132161750b38"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-condo-software%2Fgitexporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-condo-software%2Fgitexporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-condo-software%2Fgitexporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-condo-software%2Fgitexporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-condo-software","download_url":"https://codeload.github.com/open-condo-software/gitexporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221962368,"owners_count":16908329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:01:20.646Z","updated_at":"2025-12-30T01:01:34.427Z","avatar_url":"https://github.com/open-condo-software.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![npm status](https://img.shields.io/npm/v/gitexporter?color=%2332c954\u0026label=gitexporter\u0026logo=gitexporter\u0026logoColor=%23414851)](https://www.npmjs.com/package/gitexporter) [![gitexporter test status](https://github.com/open-condo-software/gitexporter/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/open-condo-software/gitexporter)\n\n# gitexporter cli tool\n\nYou're in the right place if:\n\n - Do you have an **open-source** project with an **open** and **closed part** and you want to **work in one git repo** without git submodules?\n - Do you want to **public** some **private** GitHub **repo directories**?\n - You want to **keep** the **authorship** and **history** of the **comments**\n - You don't want to use git submodules\n\nOthers cases:\n\n - You are developing in a git mono repository and want to open-source some directories\n - You are developing some OpenSource project and want to disallow open some secret files\n\n# how it works ?\n\n`gitexporter` create a new git repo from your existing repository with only allowed public files and dirs.\n\nThe `gitexporter` goes through the git commit tree and adds to a new repo only the allowed files.\n\n# Example\n\n - `/` -- monorepository root\n - `/apps/service1` -- it's open source\n - `/apps/optional-secure-service2` -- it's closed source\n - `/gitexporter.config.json` -- git exporter config file\n\n`gitexporter.config.json`\n```\n{\n    \"forceReCreateRepo\": true,\n    \"targetRepoPath\": \"my-open-source-repo\",\n    \"sourceRepoPath\": \".\",\n    \"allowedPaths\": [\"apps/service1/*\"],\n    \"ignoredPaths\": [\"apps/service1/.env\", \"apps/optional-secure-service2\", \"gitexporter.config.json\"]\n}\n```\n\nJust run `npx gitexporter gitexporter.config.json` and you will get a new git repository with just `apps/service1` directory.\n\n# GITHUB ACTIONS CI EXAMPLE\n\n 1. create a new user: `sync-bot`\n 2. add new user ssh keys `SSH_SYNC_BOT_PRIVATE_KEY`: https://github.com/settings/keys\n 3. add the user to `org/private` and `org/open` repo\n 4. add `SSH_SYNC_BOT_PRIVATE_KEY` to `org/private` repo\n 5. add CI files to `org/private` repo:\n\n`.github/workflows/gitexporter.yml`\n```yaml\nname: gitexporter\non:\n  push:\n    branches:\n      - 'master'\n\njobs:\n  gitexporter:\n    name: Gitexporter\n    runs-on: self-hosted\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n        with:\n          ssh-key: ${{ secrets.SSH_SYNC_BOT_PRIVATE_KEY }}\n      - name: Checkout org/private\n        uses: actions/checkout@v2\n        with:\n          repository: 'org/private'\n          fetch-depth: 0\n          submodules: recursive\n          ssh-key: ${{ secrets.SSH_SYNC_BOT_PRIVATE_KEY }}\n          path: gitexporter.source\n          ref: 'master'\n      - name: Checkout org/open\n        uses: actions/checkout@v2\n        with:\n          repository: 'org/open'\n          fetch-depth: 0\n          submodules: recursive\n          ssh-key: ${{ secrets.SSH_SYNC_BOT_PRIVATE_KEY }}\n          path: gitexporter.target\n          ref: 'master'\n      - name: gitexporter.sh\n        run: |\n          bash .github/workflows/gitexporter.sh gitexporter.source gitexporter.target\n          cat gitexporter.source.log.json\n```\n`.github/workflows/gitexporter.sh`\n```bash\n#!/usr/bin/env bash\nset -eo pipefail\n\nif [[ -z \"$1\" || -z \"$2\" ]]; then\n  echo \"use $0 \u003csource-git-repo\u003e \u003ctarget-git-repo\u003e\"\n  exit 2\nfi\n\nSOURCE_FOLDER=$1\nTARGET_FOLDER=$2\n\necho \"[GITEXPORTER]\"\ncat \u003e ${SOURCE_FOLDER}.config.json \u003c\u003cEOF\n{\n  \"forceReCreateRepo\": false,\n  \"followByNumberOfCommits\": true,\n  \"syncAllFilesOnLastFollowCommit\": true,\n  \"logFilePath\": \"${SOURCE_FOLDER}.log.json\",\n  \"targetRepoPath\": \"${TARGET_FOLDER}\",\n  \"sourceRepoPath\": \"${SOURCE_FOLDER}\",\n  \"allowedPaths\": [\n    \"*\"\n  ],\n  \"ignoredPaths\": [\n    \"secret/*\"\n  ]\n}\nEOF\n\nnpx gitexporter ${SOURCE_FOLDER}.config.json\n\necho \"[TARGET/SETUP]\"\ncd ${TARGET_FOLDER}\ngit branch -D master || echo \"no branch master\"\ngit checkout -B master $(git rev-parse HEAD)\necho \"[TARGET/PUSH]\"\ngit push origin master\ncd -\necho \"[END]\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-condo-software%2Fgitexporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-condo-software%2Fgitexporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-condo-software%2Fgitexporter/lists"}