HOWTO: Alternative project hosting

Alternative project hosting

We use Git for version control of all our projects. Git is a distributed version control system, which means that you can host your game code on any other Git server than the one provided by our service. We are working on a way to enable this through the editor, but it’s still possible to do with just a little bit of fiddling on your own.

Currently you still need to create a project on our dashboard just so the editor knows a project exist.

Please note this should be considered an advanced feature, use with care! :slight_smile:

How to use a custom Git server

What we need to do is change the projects origin URL. This can be done in most graphical Git clients, such as SourceTree and GitHub Desktop.

Graphical clients

  1. Open your project in the Defold editor.
  2. Right click on the game.project file, select “Show in Finder” (or similar for your platform).
  3. Add this folder to your client as a local repository, then:
    SourceTree - Repository settings;
    GitHub Desktop - Repository settings;

Command line

Prerequisite: Git - OS X, Windows, Linux

  1. Open your project in the Defold editor.
  2. Right click on the game.project file, select “Show in Finder” (or similar for your platform).
  3. Next, you need to navigate to the project location (from step 2) in a terminal window. Here’s how:
    • OS X - Open the project location in Terminal.app, for a detailed guide see this.
    • Windows - Open the project location in Git Bash, for a detailed guide see this.
  4. Lastly, change the ​origin remote to your own Git URL entering these commands into your terminal:
git remote set-url origin <your_own_git_server_url>
git push -u origin master

The Git server URL can either be your own private server, or one from a third party provider/host, see below.

How to get your Git server URL

GitHub

  1. Create a new repository
  2. Your Git URL can be found here:

BitBucket

  1. Create a new repository
  2. Your Git URL can be found here:

GitLab

  1. Create a new project
  2. Your Git URL can be found here:
22 Likes

I fallowed this tutorial. I also needed to generate ssh token, to get through the authentication issue I had (permission denied) Now I got it working with GitHub Desktop Client, but I can not open the project inside the defold IDE anymore. Since I changed the head of the git repo and its url, I think defold can not read it anymore?

  1. Is this expected behavior? If so, how can I open projects that are synched to GitHub instead of defold?
  2. Could I push commits to both repositories (defold and github)?

1 Like

Going to guess that this app is what is at fault with messing with metadata. Retry with something like SourceTree, I have got it to work with this before. Also, consider switching to Bitbucket. I find it superior to private projects personally.

I removed my repo from /applications/defold/branches/…
But I think I messed up the login token by generation a new one inside the defold project panel.
Now I always get the error from screenshot above! I can not download it anymore from defold repo.
Any way to revert this?

\Edit: I can actually not pull any of my projects. Maybe because I generated a new git ssh key and somehow overriden the old one (containing the defold ssh key)?

1 Like

As @sven mentions in the original post, this is an advanced configuration (not really a feature even), that should be used with care. There is process or functionality in place to reset a repository to it’s original state.

Could you try signing out in the editor, then signing back in again? Then try to open up the project and create a new branch.

I would recommend using an external git tool for handling more advances repository stuff like this. :thumbsup:

1 Like

I tried with signing out and in and it worked! Now I can download my projects again! Thank you @sven
I’m not very expirienced with command-line git! But I can handle visual tool like GitHub Desktop App. And I really like that I can commit only what I want, insted of having defold staging and pushing everything! (And after that push I can not revert specific files…) So I need to get this working!


**# Edit:** ok, here's what I found out... If you want to push commits manually to defold's repo (dashboard), you are out of luck with the *GitHub Desktop Client*! As soon as you change the origin remote url, the defold IDE can't relate to it anymore. On the other hand you can't push through the GitHub Client to remote repos *other than* the ones at github.com. So basically you break everything.

Changing this will break the link between Defold IDE and the online repository.


What you want do instead is using *SourceTree*, as @sven advised. Just drop your local branch (git repo) into it.

Open your repo (double click) and now you can see all previous commits. Now you can normally work with defold IDE and every time you need to save a progress step (commit) you go into SourceTree and make a commit. This is also the place where you can decide which file changes to include into a commit and which not (staging). When you push commits to Defold’s repository (dashboard), SourceTree will prompt you to type in your login. Use your eMail as username and your access token as password. Sometimes you have to type the password multiple times (once per git operation).

Additionally, if you want to maintain a separate copy of your repo, you might add an additional remote server (such as bitbucket). Don’t mess with the origin name here, if you are not experienced! This might mess up connection between defold and its repo again! Just add a second repo. Now you can push to both at will.

1 Like

Side-note: The latest and greatest in terms of Git clients seems to be Git Kraken. I haven’t made the switch from GitHub for Desktop yet, but I’ve heard a lot of good things about Git Kraken and from it’s list of features it sounds like a really nice tool.

4 Likes

Just tried GitKraken out. Seems really nice, clean, and fast! Love that it has built in integration with Bitbucket and Github! Instantly liking it more than SourceTree.

1 Like

5 posts were split to a new topic: Looks like a regression: custom git client error 500