I'm trying to join the Graphite team through an in...
# report-bugs
r
I'm trying to join the Graphite team through an invite from the organization owner and it's failed every way we've tried. I've finally managed to hit this page with the "Join Team" option, but when I click "Join Team" I just get "Unexpected Error". I've also tried to add the repository manually, and even though I have access to the repository and have been pushing code changes, I can't seem to see it in list of repositories to add. So right now I'm logged into graphite with my github account, but I can't seem to add any repositories or join the team. The repository owner is able to use Graphite just fine. Can I get any help here? Thanks!
p
(If applicable) To help us repro, please send the following if you haven't already: - PR links, screenshots, and/or debug output if applicable - Repro steps - Does this happen consistently? Just to you or others on your team also? - Is this a regression? Is the problem new? - If you're having an issue with the CLI, please send us debug logs using
gt feedback --with-debug-context <any message>
hey Ruven, are you able to see that organization's repos from in GitHub? And are you a member of that organization or an outside collaborator?
r
I can see one repo, but I'm an outside collaborator for the organization. Do I need to be part of the organization?
p
gotcha, yeah there can be permissions issues when it comes to outside collaborators. If the organization could grant your GH account write access to one public repo in it that can help to confirm your authorization for joining the team from in Graphite.
r
We don't have public repos - I do have write access to a private repo - assuming that's not good enough?
p
have seen in the past that it is not for getting authorization via GitHub's API, it must be a public repo even if it's empty
r
okay sounds good, let me figure it out - thank you
I'm in as part of the organization, but I'm not getting this - do you have a recommendation on how to fix it?
p
that may just be an eventual consistency delay as Graphite and GitHub sync. Please wait a few minutes and then refresh the Graphite UI to see if the state changes.
r
okay yeah that looks good - thank you!
While I have you here, I'm trying to set up graphite CLI for multiple github users - chatgpt gave me this - but I don't know if you have any better ideas
p
could you elaborate what you mean by set up the CLI for multiple GitHub users? Each user would need to log in to Graphite and provision their own token to use with the CLI: https://graphite.dev/docs/install-the-cli#authenticate-the-cli
r
Sorry - multiple github accounts, same person, same device - does that make sense?
p
ah, I see. This is pretty roughly supported, but in your user_config file you can set alternative named profiles with separate auth tokens:
Copy code
cat ~/.config/graphite/user_config
{
  "alternativeProfiles": [
    {
      "name": "work_github_account",
      "authToken": "xxxx"
    },
    {
      "name": "personal_github_account",
      "authToken": "xxxx"
    }
  ]
}
Then set the
GRAPHITE_PROFILE
environment variable for the one you want to run
gt
using, e.g.
GRAPHITE_PROFILE=work_github_account gt sync
r
great thank you, will try it out!
I'm getting
Copy code
Malformed JSON at /Users/ruven/.config/graphite/user_config
I've double checked that the JSON is okay - I've even tried pasting in that exact json you have (and tried removing the extra trailing comma) and nothing works - any thought here? Thanks!
p
ah, let me try test it out
r
Any luck here? This is blocking me from using Graphite at the moment. Whenever you can - thanks!
p
hey Ruven, turns out this is a misleading error as the JSON itself is valid, but the root cause is there is a field named
hostPrefix
that has to be included in the
alternativeProfiles
entries for this to work:
Copy code
cat ~/.config/graphite/user_config
{
  "alternativeProfiles": [
    {
      "name": "work_github_account",
      "authToken": "xxxx",
      "hostPrefix": ""
    },
    {
      "name": "personal_github_account",
      "authToken": "xxxx",
      "hostPrefix": ""
    }
  ]
}
Note you can also name one of the profiles as "default" for its auth token to always be used when not specifying the
GRAPHITE_PROFILE
environment variable.
r
Great thank you - what does the
hostPrefix
do here?
p
It's just an internal implementation detail
r
okay, but I should leave it empty?
p
Yes empty string as in the example
r
Thank you! Will try it out when I have a sec
works like a charm - thank you!
to anyone else who's doing this, this function in my profile has been great
Copy code
gt () {
        remotes=$(git remote -v 2>/dev/null) 
        has_work=$(echo "$remotes" | grep -q 'github-work'; echo $?) 
        has_personal=$(echo "$remotes" | grep -q 'github-personal'; echo $?) 
        if [ $has_work -eq 0 ] && [ $has_personal -eq 0 ]
        then
                echo "Error: both github-work and github-personal remotes found. Cannot decide profile." >&2
                return 1
        elif [ $has_work -eq 0 ]
        then
                GRAPHITE_PROFILE=work_github /opt/homebrew/bin/gt "$@"
        elif [ $has_personal -eq 0 ]
        then
                GRAPHITE_PROFILE=personal_github /opt/homebrew/bin/gt "$@"
        else
                echo "Error: no matching remote (expected github-work or github-personal)." >&2
                return 1
        fi
}
I installed the Grahite Mac app but it's not detecting I'm signed in - is that because of this setup? Or how do I fix this?
p
Possibly. Could you try configuring a default profile?
r
yup - that fixed it! thank you