Skip to content

Commit

Permalink
Update environment variables and documentation for GitHub PAT
Browse files Browse the repository at this point in the history
  • Loading branch information
Meteoscientific committed Nov 2, 2024
1 parent ef0f0b4 commit f9771b8
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mdx-js/react": "^3.0.0",
"@stripe/stripe-js": "^4.2.0",
"clsx": "^2.0.0",
"dotenv": "^16.4.5",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
Expand Down
57 changes: 53 additions & 4 deletions src/pages/updating-git-tokens.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# How to Update Your GitHub Personal Access Token (PAT)

Follow these steps to update your GitHub Personal Access Token when it expires or needs regeneration.
Expand All @@ -11,14 +12,62 @@ Follow these steps to update your GitHub Personal Access Token when it expires o
- **Set Permissions**:
- **Contents**: Read and write
- **Metadata**: Read-only
- **Pages**: Read and write
- **Pages**: Read-only
- **Set Organization Permissions**:
- **Members**: Read-only
- **Administration**: Read-only
- **Webhooks**: Read and write
- **Secrets**: Read and write
- **Projects**: Read and write
- **Set the Expiry Date**: Choose the maximum duration (365 days).
- **Save the token** securely (e.g., in a password manager).

---

## 2. Update Your Local Environment
- **Open your terminal**.
- **Export the new PAT**:
- **Go to VSCode and open the Meteoscientific folder**.
- **Update the .env file**:
```bash
export GIT_TOKEN=your_new_github_pat
GIT_TOKEN=`your_new_github_pat`
```
*(Obvi, replace`your_new_github_pat` with your actual token.)*

---

## 3. Verify the PAT
- Use the following `curl` command to check if your token is working:
```bash
curl -H "Authorization: token $GIT_TOKEN" https://api.github.com/user
```
- You should see your GitHub user information.

---

## 4. Deploy Your Changes
1. **Build your site locally**:
```bash
npm run build
```
2. **Serve locally to test**:
```bash
npm run serve
```
3. **Commit and push changes**:
```bash
git add .
git commit -m "Updated the PAT"
git push origin main
```
4. **Deploy the site**:
```bash
GIT_USER=your_github_username GIT_TOKEN=$GIT_TOKEN npm run deploy
```

---

## Troubleshooting
- **Deployment errors**: Check if your PAT has the right permissions.
- **Website not updating**: Clear browser and Cloudflare cache.

---

0 comments on commit f9771b8

Please sign in to comment.