Monaca allows you to connect your project with a repository using any Git services through SSH authentication. GitHub is one of Git services supporting SSH connection. Therefore, we will be using GitHub as an example in the following subsections.
In order to use version control in Monaca Cloud IDE, you will need:
Click on Generate SSH Key button.
Copy the generated key which will be used in the next section (Adding the SSH Key to Git Service).
For proper authentication between Monaca and your Git service provider, the generated SSH key from the previous section needs to be added to your Git service account.
In this example, we are using GitHub. For other services, please review your Git services’ documentation for support.
Fill in the following information:
Title: Title of the key
Key: The SSH key generated from the Monaca account earlier (as shown in the above section)
Then, click on Add SSH key button.
You can create a new repository in any Git services. In this case, we are creating a new repository in GitHub as follows:
Copy the SSH link (see below screenshot as example). We will use this link in the Monaca Cloud IDE later in the next section.
Git SSH option as shown below:
Then, you will need to input the
Repository URL (the link you
found in the above section) and
Click on Initialize button.
Your project is then being uploaded to your new repository. By default, your working branch will be configured as master. If you want to switch to another working branch, please go to Version Control Configuration page ( Version Control → Configure ).
In Import Project dialog, fill in the necessary information and
Import from Git Repository. Then, input the
Repository URL and click on Import button.
If the import is successful, the new project will be added to Monaca Dashboard. By default, master branch will be applied to the imported project. You can switch the current working branch in the Version Control Configuration page ( Version Control → Configure ).
Once you have successfully connected your project with a repository, you can start working on the same project with your team members and keep it synchronized to the latest updates in Monaca Cloud IDE.
Monaca Cloud IDE provides a very user-friendly interface supporting version control of your code. Without learning Git from the scratch, you can still perform some basic Git commands directly from the IDE.
If you have more than one branch and want to switch the current working branch, please do as follows:
Choose the branch you want to switch to from current working branch, and click Clear Cache & Save button.
If you are familiar with Git commands, retrieve changes from remotes
here refers to
git pull command. In order to retrieve the changes from
remotes, from Monaca Cloud IDE menu, go to
Version Control → Pull
there are changes in your remotes, you will receive those updates in
your working branch.
wwwfolder. Files outside of this folder are also synced even though they will not appear in the IDE.
After making changes in the current working branch, you are able to commit them back to your remote repository. To commit your changes, please do as follows:
In order to see full history of your previous commits in remote repository, go to Version Control → Show Remote History . You will be redirected to the remote Git service provider’s website showing a commit history of your current branch.
Every commit you made in your Monaca Cloud IDE is called Local Commit. You are able to view your local commit history through Version Control → Show Commit History . To view the changes in each commit, click on the commit on the left panel.