Deploy your local folder to Git with one command
Project description
Git Deployer
A utility for automated deployment of generated static websites (documentation, help guides, etc.) using Git.
Advantages
- Simplicity: Deploy with a single command.
- Reliability: Uses proven Git mechanisms.
- Versatility: Suitable for any hosting service that supports Git repositories (GitHub Pages, GitLab Pages, your own server, etc.).
- Incremental Deployment: Only modified files are transferred.
Installation
python -m pip install git+https://github.com/optinsoft/git-deployer.git
Usage
Initialization (first run)
- You generate a static site (for example, using Docusaurus, Sphinx, Jekyll, MkDocs).
- Initialize a Git repository in the directory containing the generated site (e.g.,
_build/html).
Example:
cd _build/html
git init
- Using Git, add a new remote repository and specify which remote branch your local branch should track.
Example:
git remote add origin https://github.com/owner/repository.git
git branch --set-upstream-to origin/main main
- Run
deploy.
deploy .
- The utility publishes the files to the remote repository.
To publish, Git Deployer executes the following commands:
git add .
git commit -m "Site updated: %Y-%m-%d %H:%M:%S"
git push
%Y-%m-%d %H:%M:%S will be replaced by the current date and time, ex.: 2025-09-29 10:44:15
Configuring with deploy_config.yml (alternative initialization)
An alternative initialization method involves creating a deploy_config.yml configuration file in the root directory of your project and then running the deploy _build/html command. If the _build/html directory does not already contain a Git repository and the git_init option has been set in deploy_config.yml, Git Deployer will automatically execute git init. It will then configure the remote repository, branch, and (optionally) the username and email according to the configuration file.
Configuration example:
deploy:
remote:
name: 'origin'
url: 'https://github.com/owner/repository.git'
branch: 'master'
name: owner_name
email: owner@email
message: 'new commit at %Y-%m-%d %H:%M:%S'
git_init: True
force_push: True
The force_push option allows you to deploy the site to a remote repository using git push --force. This command bypasses the standard safety checks that prevent pushing when the remote history diverges from the local history. If, even with the force_push, you get the error message "remote: error: denying non-fast-forward refs/heads/master (you should pull first)", you need to disable receive.denyNonFastForwards in remote repo. Find the [receive] section within the config file. If denyNonFastForwards is set to true, change it to false. If the setting doesn't exist, you can add it.
[receive]
denyNonFastForwards = false
You can configure the git commit message. It can contain date and time format specifiers, for example: %Y-%m-%d %H:%M:%S, which will be replaced by the current date and time.
If the project contains multiple sites, each with its own individual deployment settings (remote repository, branch, etc.), you can specify them in the sites section, for example:
deploy:
sites:
-
path: site_to_deploy
deploy:
remote:
name: 'github'
url: 'https://github.com/owner/site_to_deploy.git'
Everyday deployments
deploy _build/html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_deployer-0.1.0.tar.gz.
File metadata
- Download URL: git_deployer-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24849fb35b76b27e93e7fd9094fe0ecd34ea6b4a14152df20ac4d6fa921a615e
|
|
| MD5 |
11f3c9540a0064ebc61881089453a976
|
|
| BLAKE2b-256 |
808ddd5c57aba7b7091bfafe779360e17f915cff04fc0e990f675fbb0c241da1
|
File details
Details for the file git_deployer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: git_deployer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a5a4951a5dc48f9b0c4b01cadbcc96c696cc5f300142e8859d591c87cb2c8cb
|
|
| MD5 |
0728982e1c8be09fc40b4cef3b90ecae
|
|
| BLAKE2b-256 |
d07de8f0cc480b91a0a8a644e07e1597b6059d8815970314e83d69e2c3a0dc34
|