mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(github-auth): check ~/.hermes/.env before ~/.git-credentials for token extraction (#3466)
* fix(github-auth): check ~/.hermes/.env before ~/.git-credentials for token extraction Users who configured their token via `hermes setup` have it stored in ~/.hermes/.env (GITHUB_TOKEN=...), not in ~/.git-credentials. On macOS with osxkeychain as the default git credential helper, ~/.git-credentials may not exist at all, causing silent 401 failures in all GitHub skills. Add ~/.hermes/.env as the first fallback in the auth detection block and the inline "Extracting the Token from Git Credentials" example. Priority order: env var → ~/.hermes/.env → ~/.git-credentials → none Part of fix for NousResearch/hermes-agent#3464 * fix(github-auth): check ~/.hermes/.env before ~/.git-credentials Fixes #3464 * fix(github-auth): check ~/.hermes/.env before ~/.git-credentials Fixes #3464 * fix(github-auth): check ~/.hermes/.env before ~/.git-credentials Fixes #3464 * fix(github-auth): check ~/.hermes/.env before ~/.git-credentials Fixes #3464 * fix(github-auth): check ~/.hermes/.env before ~/.git-credentials Fixes #3464 * fix(github-auth): check ~/.hermes/.env before ~/.git-credentials Fixes #3464
This commit is contained in:
parent
f803f66339
commit
a6bc13ce13
6 changed files with 28 additions and 4 deletions
|
|
@ -29,7 +29,11 @@ else
|
|||
AUTH="git"
|
||||
# Ensure we have a token for API calls
|
||||
if [ -z "$GITHUB_TOKEN" ]; then
|
||||
GITHUB_TOKEN=$(grep "github.com" ~/.git-credentials 2>/dev/null | head -1 | sed 's|https://[^:]*:\([^@]*\)@.*|\1|')
|
||||
if [ -f ~/.hermes/.env ] && grep -q "^GITHUB_TOKEN=" ~/.hermes/.env; then
|
||||
GITHUB_TOKEN=$(grep "^GITHUB_TOKEN=" ~/.hermes/.env | head -1 | cut -d= -f2 | tr -d '\n\r')
|
||||
elif grep -q "github.com" ~/.git-credentials 2>/dev/null; then
|
||||
GITHUB_TOKEN=$(grep "github.com" ~/.git-credentials 2>/dev/null | head -1 | sed 's|https://[^:]*:\([^@]*\)@.*|\1|')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "Using: $AUTH"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue