Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Invalid Refspec Error
-
I've added the Git extension and connected to our BitBucket repository. When I try to perform an action to get the latest source through BuildMaster, I receive a dialog window that shows the repository, I click on it, it lists all of the branches it sees correctly, but when I click on a branch (e.g. master), I receive an error "ERROR: fatal: Invalid refspec 'master'". I've tried restarting both BuildMaster services but nothing I try seems to fix the issue.
The Test Connection function in the Git extension passes correctly and when I look in the installation directory I'm able to see that BuildMaster has pulled down my source correctly.
Please advise.
Product: BuildMaster
Version: 4.8.3
-
Hi Jaryd,
Hmm, that's a fairly obscure error.
According to the equally obscure Git manual, [https://git-scm.com/book/en/v2/Git-Internals-The-Refspec](The Refspec) , it could be a problem with a remote refspec.
Can you try using the standard git client instead of the built-in one?
-
I'm currently pointing to the git executable located at "C:\Program Files\Git\bin\git.exe". I don't believe that is the built-in git executable and is the standalone version I downloaded and installed to use with normal development.
-
Hmm, ok ; so I'm guessing this is an empty repository? You will need to have files committed to the branch first, otherwise git will give that error.
Branches are enumerated with "ls-remote --heads origin": https://github.com/Inedo/bmx-git/blob/master/Git/Clients/StandardGitClient.cs#L30
Branches are switched using fetch/reset/clean: https://github.com/Inedo/bmx-git/blob/master/Git/Clients/StandardGitClient.cs#L35
-
This is not an empty repository. There are hundreds of files in it. Like I said, I can see all of them being pulled down by BuildMaster.
-
OK, so in that case, it may verywell be an invalid refspec?
- git ls-remote --heads origin
- git fetch origin <branch>
- git reset --hard <ref>
- git clean -dfq
Can you try those commands against your git client?
-
I tried all of those commands, everything executed correctly and I received no errors in git. However, I'm still receiving the same error in BuildMaster. Nothing seems to have changed.
-
Were you able to get past this? What happens if you enter the path directly without browsing via the UI then executing the deployment plan? The format for the path in BuildMaster follows the pattern:
<BuildMaster repository name>|master:path/to/files
-
Manually entering the path as suggested seemed to work and at least get me passed that point. However, after selecting which project I want to create a deployable for on the next page, clicking Next throws a server error that states it can't find the path to the project. The path it is using is correct, but the base path is not.
The path I manually entered was to a path I found under the BuildMaster installation where BuildMaster seemed to have pulled down the source from the Git provider I created. Is that not the path I should have used? Should I use a path somewhere else on the drive that I manually download the source to? Although that doesn't make sense to me as I would expect BuildMaster to take care of everything automatically.
-
The reason you have to Get Latest is because otherwise if you built straight from the BuildMaster-managed "ScrRepo" directory, there would be artifacts from the SCM tool also included (for git, .git files), and other times added files from the BuildMaster build steps that you wouldn't want stored with the repo.
Once you "Get Latest" somewhere, you can operate on a fresh set of files to perform whatever build tasks are necessary for deployment. Note the "Get Latest" action will essentially perform a clone or pull from BitBucket, then copy the files to the source directory of the action.