How to Clone a Mendix Project From TeamServer Without Using Studio Pro
Suppose you are working on your Mendix project and made plenty of commits & pushes to the Mendix Git Repo — aka TeamServer. You feel safe since the version control protects your code. Nothing could go wrong, right? Wrong! Sometimes your Local Git Repo gets corrupted and you must find a way to fix it. But you cannot even open the corrupted project in your Studio Pro? What are the options to solve this issue?
Problem
A typical image confirming that this problem exists is shown below. For some reason, the Local Git Repo — the .git
folder — was corrupted and prevented you from opening your MPR Project in Studio Pro. And you usually handle the Git commands (clone, push, pull, merge) inside the Studio Pro UI. How to solve this puzzle? The solution is to handle this situation outside Studio Pro.
Solution
[1] Download and install the GIT command line tool:
- 64-bit Git for Windows Setup
- Or better, you can use the Winget Tool and run:
winget install --id Git.Git -e --source winget
[2] (Recommended) Download and install the Tortoise Git
[3] Go to your User Settings in the Mendix Portal
- Click on Developer Settings and create a new PAT. Use the blue button NewToken
- Give a name for the PAT
- Check the scopes required to access the TeamServer. You can select all, though this is not recommended.
- Copy the generated PAT to a safe place. You’ll not be allowed to see this PAT again
[4] Go to Mendix Sprintr and then click on the project on which the Local Git Repo was corrupted
[5] On the left-hand side menu, click on TeamServer
[6] Copy the TeamServer URL.
[7] On Windows Explorer, Right-Mouse-Click to open the context menu and select Git Clone… This menu was added from Tortoise Git.
[8] Paste the copied URL in the Tortoise Git Clone Dialog Box. Define the directory where the Project will cloned.
[9] You’ll be prompted to inform the Git Credentials: the email you use to access the TeamServer and the PAT you created on the step [3]
[10] You should now see flying turtles of the Cloning progress
[11] Now you can try to open your project again on Studio Pro and see if this procedure works
[12] Obviously, for those from the old guard, this cloning process can be done via the command line: git clone https://pat:{USERPAT}@git.api.mendix.com/{APPID}.git
- APPID is the code you get in the Settings of your Project in the Sprintr
- USERPAT is the PAT you’ve created in step 3
Conclusion
It’s wise to know the basics of the Git Commands, even when working with LowCode. And if you don’t like the command line, Tortoise Git is an amazing tool. I’ve been particularly using it for ages, with no problems at all.
In addition, would be nice if we could solve Git-related problems from the Studio Pro UI. Maybe an option in the Studio Pro Welcome screen…