Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

"undefined method `repo' for GHI:Module" on fresh install #275

Closed
danielsamuels opened this issue Feb 11, 2016 · 28 comments
Closed

"undefined method `repo' for GHI:Module" on fresh install #275

danielsamuels opened this issue Feb 11, 2016 · 28 comments
Assignees

Comments

@danielsamuels
Copy link

  • Installed via brew install ghi
  • Ran ghi config --auth danielsamuels
  • Entered 2FA code

When I run ghi I get this:

⠋security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
#
/usr/local/bin/ghi:2391:in `authorize!': undefined method `repo' for GHI:Module (NoMethodError)
    from /usr/local/bin/ghi:108:in `rescue in execute'
    from /usr/local/bin/ghi:24:in `execute'
    from /usr/local/bin/ghi:4282:in `<main>'
@AlexChesters
Copy link
Contributor

Interesting, does your username or password contain any non-ASCII characters?

@danielsamuels
Copy link
Author

No, it's 100 characters consisting of a-z, A-Z, 0-9 and special characters (such as *, ^, # etc.)

Strangely enough, I wasn't actually asked for my username or password, not sure if that's supposed to happen?

@AlexChesters
Copy link
Contributor

Ahh of course, you're using 2FA. Apologies, I misread. I'll look into this now.

@AlexChesters AlexChesters self-assigned this Feb 11, 2016
@AlexChesters
Copy link
Contributor

Your username is given in the command ghi config --auth danielsamuels, but it should prompt for your password and then your 2FA (that's what happens for me anyway). What version of ghi are you using? ghi -v?

@danielsamuels
Copy link
Author

$ ghi -v
ghi version 1.0.3

@AlexChesters
Copy link
Contributor

1.0.4 contained a patch to the way ghi handles authorisation. Would you mind updating to the latest version (1.1.0) attempt to reproduce? Thanks!

@danielsamuels
Copy link
Author

$ brew update
$ brew upgrade ghi
$ ghi -v
ghi version 1.1.0
$ ghi
⠉security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
#
/usr/local/bin/ghi:2392:in `authorize!': undefined method `repo' for GHI:Module (NoMethodError)
    from /usr/local/bin/ghi:108:in `rescue in execute'
    from /usr/local/bin/ghi:24:in `execute'
    from /usr/local/bin/ghi:4286:in `<main>'

@AlexChesters
Copy link
Contributor

Does the following happen when trying to run ghi config --auth danielsamuels? What version of OS X are you running?

@danielsamuels
Copy link
Author

$ ghi config --auth danielsamuels
                                                     ⠸security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
                                                     ✔
Two-factor authentication code: 000000
A ghi token already exists!

Please revoke all previously-generated ghi personal access tokens here:

  https://github.com/settings/tokens

It might be worth noting that my ~/.gitconfig contains this:

[credential]
    helper = osxkeychain

@AlexChesters
Copy link
Contributor

Interesting, what's that [credential] entry for?

@danielsamuels
Copy link
Author

It allows cloning via HTTPS from Github to work without requiring you to log in every time.

More info available here: https://help.github.com/articles/caching-your-github-password-in-git/

@AlexChesters
Copy link
Contributor

Would you mind removing that temporarily and seeing what happens when you run ghi config --auth danielsamuels?

@danielsamuels
Copy link
Author

Didn't seem to make a difference unfortunately:

$ ghi config --auth danielsamuels
                                                     ⠁security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
                                                     ✔
Two-factor authentication code: 000000
A ghi token already exists!

Please revoke all previously-generated ghi personal access tokens here:

  https://github.com/settings/tokens

@AlexChesters
Copy link
Contributor

can you post your ~/.gitconfig?

@danielsamuels
Copy link
Author

$ cat ~/.gitconfig
[user]
    name = Daniel Samuels
    email = daniel.samuels1@gmail.com
[push]
    default = simple
[help]
    autocorrect = 1
[core]
    editor = nano
    mergeoptions = --no-edit --no-commit
    excludesfile = /Users/danielsamuels/.gitignore_global
[alias]
    cleanup = "!git branch --merged | grep  -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d"
    pp = !git pull --rebase && git push
    ppu = !git pull --rebase && git push && ./manage.py update
    pr  = "!f() { git checkout develop && git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1 && git rebase -i origin/develop && git checkout develop && git merge - && git push; }; f"
    prm  = "!f() { git checkout master && git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1 && git rebase -i origin/master && git checkout master && git merge - && git push; }; f"
[color]
    ui = true
    diff = true
[difftool "sourcetree"]
    cmd = opendiff \"$LOCAL\" \"$REMOTE\"
    path =
[mergetool "sourcetree"]
    cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
    trustExitCode = true
[filter "lfs"]
    clean = git-lfs clean %f
    smudge = git-lfs smudge %f
    required = true
[credential]
    helper = osxkeychain
[pull]
    rebase = true
[github]
    user = danielsamuels
[ghi]
    token = !security find-internet-password -a danielsamuels -s github.com -l 'ghi token' -w

@AlexChesters
Copy link
Contributor

Do you get the error when you run !security find-internet-password -a danielsamuels -s github.com -l 'ghi token' -w manually?

@danielsamuels
Copy link
Author

Sorry, how do I run that? It doesn't seem to work by itself or after git or ghi.

@AlexChesters
Copy link
Contributor

You need to remove the ! from the beginning

@danielsamuels
Copy link
Author

$ security find-internet-password -a danielsamuels -s github.com -l 'ghi token' -w
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

@AlexChesters
Copy link
Contributor

If you go in keychain access and search for github, which account does it say?
screen shot 2016-02-11 at 13 06 22

@danielsamuels
Copy link
Author

I've got 4 items:




@AlexChesters
Copy link
Contributor

Can you remove those and see if that resolves it?

@danielsamuels
Copy link
Author

Removed all 4:

$ ghi
⠒security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
#
/usr/local/bin/ghi:2392:in `authorize!': undefined method `repo' for GHI:Module (NoMethodError)
    from /usr/local/bin/ghi:108:in `rescue in execute'
    from /usr/local/bin/ghi:24:in `execute'
    from /usr/local/bin/ghi:4286:in `<main>'

@danielsamuels
Copy link
Author

Trying with --auth again:

$ ghi config --auth danielsamuels
                                                     ⠸security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
                                                     ✔
Two-factor authentication code: 000000
A ghi token already exists!

Please revoke all previously-generated ghi personal access tokens here:

  https://github.com/settings/tokens

$ ghi
⠓security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
#
/usr/local/bin/ghi:2392:in `authorize!': undefined method `repo' for GHI:Module (NoMethodError)
    from /usr/local/bin/ghi:108:in `rescue in execute'
    from /usr/local/bin/ghi:24:in `execute'
    from /usr/local/bin/ghi:4286:in `<main>'

@AlexChesters
Copy link
Contributor

I'm still relatively new to this project but I've just found that this appears to be a duplicate of #189. Can you try the steps here to see if they work?

@AlexChesters
Copy link
Contributor

Also, do you use SourceTree?

@danielsamuels
Copy link
Author

I do use SourceTree. Just reading through that thread and trying out the solutions, the final method which worked for me was:

  • Running git config --global ghi.token "\!security find-internet-password -a danielsamuels -s github.com -w"
  • Removing the ghi token from https://github.com/settings/tokens
  • Running ghi config --auth

@AlexChesters
Copy link
Contributor

It looks like ghi and SourceTree conflict, resulting in this error. I'll post a note on the README.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants