https://github.com/bernankez/git-sync
Auto sync repos when pushing to git
https://github.com/bernankez/git-sync
Last synced: 3 days ago
JSON representation
Auto sync repos when pushing to git
- Host: GitHub
- URL: https://github.com/bernankez/git-sync
- Owner: Bernankez
- License: mit
- Created: 2024-01-18T17:44:04.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-11T09:15:41.000Z (almost 2 years ago)
- Last Synced: 2025-09-23T19:58:27.117Z (9 months ago)
- Language: TypeScript
- Size: 256 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-sync
[](https://www.npmjs.com/package/@bernankez/git-sync)
[](https://github.com/Bernankez/git-sync/actions)
[](https://github.com/Bernankez/git-sync/blob/master/LICENSE)
Auto sync repos when pushing to git.
## Install
`git-sync` should be installed in your project instead of globally.
```sh
$ npm i -D @bernankez/git-sync
```
## Usage
1. Create a config file named `gitsync.config.ts` or `gitsync.config.js` in the root of your project. For example
gitsync.config.ts
```ts
import { defineConfig } from "@bernankez/git-sync";
export default defineConfig({
remoteName: "origin",
url: ["git@github.com:Bernankez/git-sync.git", "git@github.com:Bernankez/example.git"]
});
```
2. Run the CLI to update git config
```sh
$ npx git-sync
```
3. You can also add the CLI to your `package.json`, so it can automatically run after `npm install`
```json
{
"scripts": {
"prepare": "git-sync"
}
}
```
> [!NOTE]
> If you accidentally set the wrong git url and it has been added to your git, please go to the `[project root dir]/.git` and remove the line `url = [your incorrect git url]` in the `config` file.
## Configuration
### CLI
#### --config \
Specific where you want to read the config file from.
#### --git \
Specific git base dir.
### Configuration file
#### remoteName
Remote name, defaults to origin.
#### fetch
If remoteName is not added, fetch will be used as the parameter when adding remote.
#### url
Git urls that you want to push to.
#### gitBaseDir
Same as `--git` in CLI. `--git` has higher priority than `gitBaseDir`.
## What's behind
```sh
git init
git remote add
git remote set-url --add
git remote -v
```
## License
[MIT](LICENSE) License © [科科Cole](https://github.com/Bernankez)