GitHub Setup
This page explains how to configure GitHub integration in APD.
Prerequisites
Before configuring GitHub integration:
- GitHub account (personal or organization)
- A repository with at least one file (not empty)
- Personal Access Token with appropriate permissions
- Allow HttpClient Requests enabled for APD extension
Creating a Personal Access Token
APD uses Personal Access Tokens (PAT) to authenticate with GitHub.
Classic Token (Simplest)
- Go to GitHub Settings
- Click Generate new token → Generate new token (classic)
- Enter a descriptive note (e.g., "APD Portal Designer")
- Set expiration (recommend 90 days or custom)
- Select scopes:
- ✅
repo(Full control of private repositories)
- ✅
- Click Generate token
- Copy the token immediately (you won't see it again!)
Fine-Grained Token (More Secure)
For enhanced security, use fine-grained tokens:
- Go to GitHub Settings
- Click Generate new token
- Enter token name and expiration
- Under Repository access, select Only select repositories
- Choose your portal repository
- Under Permissions → Repository permissions:
- Contents: Read and write
- Metadata: Read-only (required)
- Click Generate token
- Copy the token immediately
APD Configuration
Accessing Setup
- Open the Advanced Portal Designer menu page (search for it in Tell Me)
- Click Setup to open the APD Setup card
- Fill in the GitHub fields (
GitHub Account Name,GitHub Personal Token,GitHub Repository,GitHub Branch)
Configuration Fields
| Field | Description | Example |
|---|---|---|
| GitHub Account Name | Your GitHub username or organization name | mycompany |
| GitHub Personal Token | The PAT you generated | ghp_xxxx... |
| GitHub Repository | Repository name (without owner) | portal-config |
| GitHub Branch | Branch to use for commits/pulls | main |
Example Configuration
GitHub Account Name: contoso
GitHub Personal Token: ghp_1234567890abcdefghij...
GitHub Repository: customer-portal
GitHub Branch: main
Finding Your Values
Account Name:
- For personal accounts: Your GitHub username
- For organizations: The organization name
- Example: In
https://github.com/contoso/portal-config, account name iscontoso
Repository:
- Just the repository name, not the full URL
- Example: In
https://github.com/contoso/portal-config, repository isportal-config
Verifying Configuration
Test the Connection
After configuration:
- On the Setup page, click Commit to GitHub
- Confirm the action when prompted
- If successful, you'll see "GitHub updated!"
- Check your GitHub repository for the new files
Common Verification Errors
| Error | Solution |
|---|---|
| "Your GitHub setup is incomplete" | Fill in all four GitHub fields |
| "Cannot publish to a complete empty repository" | Add a README to your repo first |
| "GitHub Account Name or Repository does not seem to be correct" | Verify account and repo names |
| "GitHub Connection failed, error (401)" | Token is invalid or expired |
| "GitHub Connection failed, error (403)" | Token lacks required permissions |
| "GitHub Connection failed, error (404)" | Repository not found or no access |
Token Management
Token Security
- Store tokens securely
- Never commit tokens to repositories
- Use different tokens for different environments
- Set appropriate expiration dates
Rotating Tokens
When tokens expire or need rotation:
- Generate a new token in GitHub
- Update the GitHub Personal Token field in APD Setup
- Delete the old token in GitHub
Revoking Access
If a token is compromised:
- Go to GitHub Token Settings
- Click Delete next to the compromised token
- Generate a new token
- Update APD with the new token
Repository Preparation
Required: Non-Empty Repository
APD cannot push to an empty repository. Ensure your repo has at least one file:
- When creating: Check Add a README file
- For existing empty repos: Add any file through GitHub web interface
Recommended: Branch Protection
For production branches, consider:
- Go to Settings → Branches
- Add a branch protection rule for
main - Consider requiring pull request reviews
Recommended: Private Repository
For portal configurations:
- Keep repositories private
- Only grant access to authorized personnel
- Use organization repositories for teams
Multiple Environments
Different Branches for Environments
Configure each environment to use a different branch:
| Environment | Branch | Purpose |
|---|---|---|
| Development | develop |
Active development |
| Sandbox | staging |
Testing before production |
| Production | main |
Live portal |
Switching Branches
To change the target branch:
- Open the Advanced Portal Designer menu and click Setup
- Change the GitHub Branch field
- Pull or commit to synchronize
Troubleshooting
"Allow HttpClient Requests" Error
If you see this error:
- Go to Extension Management
- Find Advanced Portal Designer
- Click Configure
- Enable Allow HttpClient Requests
Connection Timeouts
If GitHub operations timeout:
- Check your internet connection
- Verify GitHub status at githubstatus.com
- Try again in a few minutes
Token Expired
If operations fail with 401 errors:
- Check token expiration in GitHub
- Generate a new token
- Update APD configuration