Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Disclaimer: Please note that, while the ThingWorx Git Backup Extension is a very useful tool, it is not a PTC product, nor is it supported by PTC.
Hi ThingWorx users,
Trying to manage your ThingWorx application artifacts in a CI process? Wondering who changed that line of code in your Thing Service? Trying to see what your Mashup looked like last release? Time to Git excited! Introducing the Git Backup Extension, an open-source tool available here to offer a stronger integration with the Git source repository. This Git feature can push or pull code and artifacts (like entities, data exports or extension dependencies) to your Git repository.
Here are some highlights of how this works within ThingWorx:
First, configure your Git repo to work with ThingWorx by creating a Git Backup Thing. Then, simply open your new Thing, navigate to the Configuration editor and enter information like your Git URL, your Git username and password, your repo and branch names, etc. See example below.
Configuring your Git repoWith this configuration in place, you can now use the Home Mashup of this new Git thing to browse the repository and pull down contents to your local ThingWorx instance. For new projects, you can also push new entities to the repo as you work on your application.
As you and your team are working, you’ll want to see the differences of the files you are editing and working on collaboratively. The Git extension feature makes this easy. Just like you can see diffs clearly delineated for a file with your Git client, you can see the same with this Git integration in ThingWorx. Similar to the git status command, the Git ThingWorx extension will show you the list of files you have changed that are available to push, as well as their diffs. See an example below.
Checking the Git status
While working, if you want to switch branches or pull down a new project, you can check out a specific version and see all commits available on that branch (see below).
Checking out a specific commit
Want to learn more or try it for yourself? Find the open-source Git Backup Extension here and check out the Git Backup Extension User Guide for guidance.
Stay connected,
Kaya
P.S. What do you think? Comment your thoughts below!
Great article!
Hi Kaya!
Do you know if an equivalent extension exists, providing configuration management integration with SVN (Apache Subversion)?
SVN is still often the default configuration management system on a lot of projects.
Thanks,
Sébastien
Hi Sébastien,
Thanks for reaching out. Currently, we do not have plans for SVN for the Extension. Although, as you may already know, SVN can be used with ThingWorx through the "Export to Source Control" feature of our entities/application constructs.
Hey users, anyone else want SVN? Comment here!
-Kaya
Thanks Kaya.
The export entities for Source Control does not provide an easy "thing by thing" handling (checkout/commit) like the Git extension.
Regards,
Sébastien
Hi,
I have installed this extension and configured.
I am not able to see any repository on mashup page .
I am able to use all git commands from repository created into storage, but only tis it is not getting displayed in mashup. Find attached screen shot for reference.
Let me know if anyone has faced this issue.
Thanks in advance,
Vishwas
Vishwas, can you share the values from the Configuration page from that Git thing that was created?
Also, can you share if the Thing has a ThingShape attached in the General Information page?
Hi:
Can you first check if the bitbucket url link is in the format https://bitbucket.org/[user/team]/[repositoryname] ?
<Vishwas> Yes Bitbucket URL is this format
Second, are you using absolute or relative paths in your platform-settings.json file?
<Vishwas> Its absolute path
Third, have you tried doing a Pull and post the results of the Application Log?
<Vishwas> I was getting error in application logs
[context: com.thingworx.webservices.context.HttpExecutionContext@2eb0da7b][message: File Repository Must Be Specified]
but after some time that error also gone.
Now not getting any error.
I can do all operations by going to that repository into file system but not able to see in mashup.
Thanks,
Vishwas
Thanks Vladimir,
It was really quick.
I think this extension is must have for any project and should be included in out of the box ThingWorx product.
Vishwas
Hello
Is the Git backup extension still available? I can't find it on the Marketplace. And is it compatible with Thingworx 8.5?
Version 3.0.0 was released:
-it was tested against ThingWorx version 8.5.x
-removes the lastModifiedDate to allow easier to understand commits
-allows developers to commit using their own Commit Name and Email (persistence per user, via UserExtensions ThingShape)
-documentation updated
GitBackup version 3.0.1 was released:
-tested to allow compatibility from 8.2.0 (Community enhancement - Petrisor Lacatus)
Hi,
I am using ThingWorx 8.3.13-b41 version of thingworx and I am not able to load the GitBackupExtension. It is showing me one error.
Thanks, I found <preview> in 7 mashups and when I tried to import it again, I faced below issues which I resolved by removing the attributes ( 'aspect.bindingDirection', 'aspect.isMandatory' and 'aspect.isFlex' ) from the properties. Not sure about the impact of these changes which I made to resolve this issue.
Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_500ad6c5-cd57-4368-93ec-79fecab9eabc\GitBackupExtension\Entities\Mashups_GitBackup.NewRepo.Mashup.xml: (47, 30): cvc-complex-type.3.2.2: Attribute 'aspect.bindingDirection' is not allowed to appear in element 'FieldDefinition'.
Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_bdf1f3ba-bf3e-42b3-810f-a933d1079211\GitBackupExtension\Entities\Mashups_GitBackup.NewRepo.Mashup.xml: (46, 30): cvc-complex-type.3.2.2: Attribute 'aspect.isMandatory' is not allowed to appear in element 'FieldDefinition'.
Error parsing C:\ThingworxStorage\extensions\temp\GitBackupExtension_ae9c5436-ea48-4898-babd-540e0ea8806e\GitBackupExtension\Entities\Mashups_GitBackup.PushSettings.Mashup.xml: (25, 18): cvc-complex-type.3.2.2: Attribute 'aspect.isFlex' is not allowed to appear in element 'Mashup'.
One more issue I have faced.. after connecting my fresh repo with azure repo(fresh), it was not pushing or pulling anything. I am facing some issues of unauthorized access.
=====>>>>
Pull Error: org.eclipse.jgit.api.errors.TransportException: https://NewOrg21@dev.azure.com/NewOrg21/ThingworxProject/_git/ThingworxProject: not authorized at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:255) at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:296)
=====>>>>
To resolve this, I opened my local repo in cmd and ran "git push --set-upstream origin master" command. I am perfectly synced with Azure and call perform pull & push without any issue using cmd. What it means is, when I set the configuration with Azure, it created ".git" hidden folder which contains the info of out remote repo which is azure in our case. I am not getting connected by pull & push services because it says unauthorized access how ever able to do so using cmd.
Regards
Shyam
Check the following items:
1. If you used your complete Azure account username as the Git username (which means your complete email address)
2. If you used your Azure account password as the password in the GitBackupExtension
Thanks... Instead of password I used Personal Access Token which I generated in Azure.
So username = full email
password = PAT
Regards
Shyam
yes.. I was able to connect to azure repo further facing issues with new branches created and syncing them again. Sometimes I take help from cmd.
regards
Shyam
Yeah, branches must be created in the online Azure interface. After that, do a pull and they should show up in the branch list in the extension UI.