pyRevit Extension from private GitHub Repo?

Hi,
I’m making a tutorial on Git for pyRevit users and got an issue when trying to install from private GitHub Repo.

ERROR [Extensions] Error installing package. | remote authentication required but no callback set 

Traceback: 
 File "C:\Users\Lenny 16 Inch\AppData\Roaming\pyRevit-Master\extensions\pyRevitCore.extension\pyRevit.tab\pyRevit.panel\Extensions.smartbutton\script.py", line 405, in install_ext_pkg 
 extpkgs.install(self.selected_pkg.ext_pkg, 

It’s a common issue but I had a solution that worked before, but not anymore.

The login and password in pyRevit extensions menu always gave an error, because GitHub has removed API access with the account password, and instead forced us to create Access Tokens since 2021 I think.

I had a solution that worked a year ago and it helped me and a few other people who asked me how to do it. But it doesn’t work anymore and I’m confused what has changed.

This is how I used to do that:

  1. Open GitHub Account Settings
  2. Open Developer’s Settings (The bottom option)
  3. Click on Fine-Grained Tokens
  4. Fill some values
  • Token Name(name shown in GitHub)
  • Expiration (I think 1 year is the max, you can try longer)
  • Repository Access: You can select All Repositories or select a specific one
  1. Set Permissions for content access to read-only (IMPORTANT STEP!)
  2. Click on Generate Token
  3. Save Token to a Text File, or somewhere secure! GitHub won’t show it again!
  4. Lastly, Write Credentials in pyRevit Extensions Menu and use token instead of a Password.

These steps used to work ~ 1 year ago, but recently I tried and nothing has worked. I wonder if anyone has a solution to that or I should dig deeper myself?

Thanks for reading this far :raised_hands:

  • Erik
2 Likes

I was about to write you that I wasn’t able to install EF-Tools through extensions. Glad that you are aware of the issue hopefully it will be resolved soon.

@tayOthman, This issue is unrelated to EF-Tools.

EF-Tools is publicly available, and shouldn’t have any issues with installation.
Did you get any error messages during installation?

Usually people can’t install EF-Tools because of Firewall settings protecting companies from installing any software without IT permission.
Maybe ask if that could be the case.

No this is my personal machine, probably it is caused by a bug in pyrevit 5 wip?

Oh, That’s already another issue related to LibGit2Sharp library.
I think that could be due to updated .NET Framework of the new pyRevit.

Thanks for pointing it out!

1 Like

Hi Erik,

I use variations of this batch script to handle install, update or removal of custom extensions from private repo using a token generated from Github, Bitbucket, etc.:

@echo off
REM Script to install, update or remove MY CUSTOM extension
REM Usage: YOUR_SCRIPT.bat install|update|remove [dev]

set "userprofile=%USERPROFILE%"
set "extension_path=%userprofile%\AppData\Roaming\pyRevit\Extensions"
set "extension_name=YOUR_EXTENSION_NAME"

if "%2"=="" (
    set "repo_branch=master"
    )
if "%2"=="dev" (
    set "repo_branch=develop"
)


set "token=TOKEN"
set "repo_url=https://x-token-auth:%token%@PROVIDER.COM/USER/REPO_NAME.git"

if "%1"=="install" (
    pyrevit extend ui %extension_name% %repo_url% --dest=%extension_path% --branch=%repo_branch% --debug
    )

if "%1"=="update" (
    echo Updating extension %extension_name% in %extension_path%
    pyrevit extensions update %extension_name% --token=%token%
    )

if "%1"=="remove" (
    if not exist "%extension_path%" (
        echo Extension path %extension_path% does not exist. Nothing done.
        exit /b
    )
    echo Removing extension from pyRevit extensions paths
    pyrevit extensions delete %extension_name%
    pyrevit extensions paths forget %extension_path%
    )

You can call it from your scripts like

basepath = EXEC_PARAMS.command_path.split('\\')[:-3]
command = '{}\\dev\\YOUR_SCRIPT.bat'.format('\\'.join(basepath))
param1 = 'update'

if not os.path.exists(command):
    forms.alert('Nothing done. Update script not found', title="Updater ERROR", exitscript=True)

task = subprocess.Popen([command, param1], stdout=subprocess.PIPE)
out, err = task.communicate()
output = script.get_output()

Hope it helps.

Iván

2 Likes