Open jlengstorf opened 1 year ago
Unfortunately I'm not able to replicate. I will dig a little deeper into the error above and the init
command to see if I can understand why it may fail.
System:
OS: macOS 12.5.1
CPU: Apple M1 Pro
Binaries:
Node: 16.16.0
npm: 9.1.1
npmGlobalPackages:
netlify-cli: 12.2.6
One quick fire suggestion on this is to maybe create a new access token for your GitHub CLI. Once that's configured, go through the repro steps again and see if you get the same error. I'll have a further investigation to see if I can give more precise advice.
@lemusthelroy I just created a new token (gh auth logout
, gh auth login
) and verified that the token did indeed change.
Same error when using ntl init
.
I also just validated that we don't remove all files when uninstalling. I ran npm uninstall -g netlify-cli
, then reinstalled and I was still logged in — I'm pretty convinced the problem is related to me having multiple instances of these system files stored away somewhere, but I can't figure out where.
Okay — I was able to reproduce and fix the issue. I do still think there's a bug, but I don't know how to get further than I got. 😅
I dug into how config is stored and ended up here: https://github.com/netlify/cli/blob/9571399edfdca3cec470a1275ce8fcc1a6d1c103/src/lib/settings.cjs#LL6C26-L6C26
I'm on macOS, so I ran rm ~/Library/Preferences/netlify
— this successfully cleared things out for me.
I then ran ntl login
— sent me to the browser to authenticate and everything worked as expected.
Next, I ran ntl init
. It offers two options for connecting to GitHub: app.netlify.com or a GitHub token.
First, I chose app.netlify.com and got the same error:
github.com/learnwithjason/site-test on main [?] took 22s
❯ ntl init
? Netlify CLI needs access to your GitHub account to configure Webhooks and Depl
oy Keys. What would you like to do? Authorize with GitHub through app.netlify.co
m
? Your build command (hugo build/yarn run build/etc): # no build command
? Directory to deploy (blank for current dir): .
Adding deploy key to repository...
(node:35221) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
› Error: Failed adding GitHub deploy key with error: Not Found. Does the repository site-test exist and do learnwithjason has the correct permissions to set up deploy keys?
I have no idea why this happens, because I can successfully add sites from the learnwithjason org through the app.netlify.com UI.
After this failed, I blew everything away again and started over. When I ran ntl init
this time, I chose "Authorize with a GitHub personal access token". I got the token by running gh auth token
.
This worked as expected and I'm now able to set up new sites from the command line again.
If I can add any additional details about my UI setup, please let me know. I don't know if this is an issue that happens to people other than me, but it would be great to double check since not being able to initialize sites from a GitHub org is a big issue.
Thanks!
Describe the bug
I've had a weird issue with the CLI where I can't use
ntl init
. Whenever I try to initialize a site from within my GitHub org (learnwithjason
) I get the error:I have logged out, logged in again, and made sure that my account has the right permissions. It's all there.
I have a suspicion that this is due to the files the CLI creates on my computer to track tokens, etc. — I use
nvm
,volta
, etc. (my show has me installing all sorts of stuff), and I have a hunch that there are system files that I can't find that are being picked up instead of the ones that should be picked up.What I need help with
Where are CLI files created? (And where have they been created historically?) I want to do a thorough cleaning out of all state files to see if it solves this issue.
Steps to reproduce
Configuration
No response
Environment