A PAT (Personal Access Token) is a secure credential provided by Git platforms such as GitHub, Gitee and GitLab. It replaces your account password for Git pull and push operations.
All major Git platforms have disabled direct password authentication for Git over HTTPS. You must use a PAT to pull and push your repository via HTTPS.
Important: The PAT is shown only once after creation. You cannot view it again once you close the page. Copy and save it immediately.
Fill in the fields on Leaf Note Git Sync settings page following these rules:
We recommend using Classic Personal Access Token for best compatibility.
Steps:
Sign in to GitHub, click your avatar in the top-right corner → Settings
Scroll down and open Developer settings → Personal access tokens → Tokens (classic)
Click Generate new token (classic)
Enter Note: Leaf Note Sync
Set Expiration (90 days or custom expiry is suggested)
Under Scope, check repo (required for full repository read and write access)
Scroll to the bottom and click Generate token
Copy your token starting with ghp_ and paste it into Leaf Note configuration
Gitee names PAT as "Private Token". It works well for users with connections to mainland China.
Steps:
Log into your Gitee account, click avatar on top right → Settings
Select Security Settings → Private Tokens on the left menu
Click Generate new token
Description: Leaf Note Git Sync (custom label for easy identification)
Check permission: projects (read & write repository) (only this permission is required for note sync)
Submit, complete password or SMS verification to generate token
Copy the full token string immediately and fill it into Leaf Note
For self-hosted GitLab or official GitLab users.
Steps:
Log into GitLab, click your avatar in top-right → Edit profile
On the left menu: Access Tokens
Fill token name and expiry date
Check scopes: read_repository, write_repository (repository read and write permission)
Create token and copy it right away
Git sync in Leaf Note is an advanced feature for technical users. Automatic sync can resolve simple single-file text conflicts. When multi-file conflicts, directory structure conflicts or binary attachment conflicts occur, sync will abort automatically. You need to repair conflicts manually with tools like VSCode or GitKraken.