Reference Not Found

I am attempting to create an installer, using Powershell, to distribute pyRevit CLI to my team and include our extension from GitHub. Currently, I am receiving an error, “reference ‘refs/remotes/origin/master’ not found” (image below).

I’m not sure what that reference is supposed to be included in. I am extremely new to this whole process. I tried following the tutorial, at the below link, for this and am currently running into this issue.

pyRevit For Teams

Would you mind sharing the code in your installer?

# install CLI dependencies
Write-Output "Installing .Net (4.8)..."
Start-Process -FilePath ".\Downloads\ndp48-devpack-enu.exe" `
              -ArgumentList "/q /norestart" `
              -Wait `
              -Verb RunAs > $null

# install/update pyRevit CLI
Write-Output "Installing pyRevit..."
Start-Process -FilePath ".\Downloads\pyRevit.CLI_4.8.8_signed.exe" `
              -Wait `
              -ArgumentList "/exenoui /qn" > $null

$env:Path = "C:\Program Files\pyRevit CLI"

# pyRevit deploy root path
$pyrevitroot = "C:\pyRevit"

# the name of the clone we are going to create
$ourclonename = "ACCO Ribbon"

# pyrevit clone install path
$pyrevitcoredest = $(Join-Path $pyrevitroot $ourclonename)

# pyRevit extension install path
$pyrevitexts = $(Join-Path $pyrevitroot "Extensions")

# your custom pyRevit extension name and repo path
$ourextname = "XXXX"
$ourpyrevitext = "https://github.com/XXXXXXXX/XXXX-Xxxxxx.git"

# clone pyRevit
function Clone-PyRevit() {
    # make sure paths exits and are clean
    Confirm-Path $pyrevitroot
    Confirm-Path $pyrevitexts

    # close all open Revits first
    Write-Output "Closing All Revits..."
    pyrevit revits killall

    # forget all previous pyRevit clones if any
    pyrevit clones forget $pyrevitclonename > $null

    # clone pyRevit now
    Write-Output "Cloning Core..."
    pyrevit clone $ourclonename --dest=$pyrevitcoredest
}

# confirms target path exists and is empty. removes existing if found
function Confirm-Path ([string] $targetpath) {
    Write-Output "Confirming $($targetpath)"
    If (Test-Path $targetpath) {
        Remove-Item -Path $targetpath -Recurse -Force
    }

    New-Item -ItemType Directory -Force -Path $targetpath > $null
}

# install extensions
function Install-Extensions() {
    # make sure paths exits and are clean
    Confirm-Path $pyrevitexts

    # install extensions now
    Write-Output "Cloning Extensions..."
    pyrevit extend "pyApex" --dest=$pyrevitexts

    # clone the pyRevit extension now
    Write-Output "Cloning Extensions..."
    pyrevit extend ui $ourextname $ourpyrevitext --dest=$pyrevitexts --username=XXXXXXXXX --password=XXXXXXXXXXX
}

function Configure-PyRevit() {

    # make necessary config changes
    Write-Output "Configuring pyRevit..."
    pyrevit configs logs none
    pyrevit configs checkupdates disable
    pyrevit configs autoupdate disable
    pyrevit configs rocketmode enable
    pyrevit configs filelogging disable
    pyrevit configs loadbeta disable
    pyrevit configs usagelogging disable

    # this final step is critical
    # this seeds the config file for all the future users
		pyrevit configs seed
}

function Attach-PyRevit() {
    Write-Output "Attaching pyRevit to Installed Revits..."
    pyrevit attach $ourclonename 277 --installed --allusers
}

function Test-CommandExists {
    param ($command)
    $oldPreference = $ErrorActionPreference
    $ErrorActionPreference = 'stop'
    try {
        if(Get-Command $command){
            return $true
        }
    }
    catch {
        return $false
    }
    finally {
        $ErrorActionPreference=$oldPreference
    }
}

# orchestrate the installation
if (Test-CommandExists "pyrevit") {
		Clone-PyRevit
		Install-Extensions
		Configure-PyRevit
    Attach-PyRevit
}

it seems the error is happening here

I was able to locate the issue. The issue was with the branch of the Git repository. The default name for the branch on the repo is “main” and it looks like the CLI needs this to be renamed to “master” instead.

image

1 Like

You can actually specify the branch name when extending using --branch=<branch_name> switch. master used to be the ubiquitos default eveywhere and now it’s a mix of master and main. I gotta update the CLI