Using Git with Smartface Cloud IDE to Manage and Sync Projects

Each application project is actually a standalone Linux system and almost any Linux commands are available in the Smartface Terminal. You can also use the Terminal for source control for Git, Mercurial and SVN repositories.

Tips

To learn git in detail, you can check git commands here.

How to use Git in IDE and in the terminal?

When creating a new app project (workspace), you can clone a git project by just typing your git project URL as shown below:

In the Workspace, the SOURCE CONTROL tab can be opened by the left panel, you can check your codes change as a Working Tree by clicking on the file name twice.

Smartface Terminal also shows the changed files by typing git status command.

You can add your changes in the working directory by clicking on the first right plus button or typing git add <file> command in Smartface Terminal.

the next button is to open the file.

the back arrow button is to discard changes in working directory which can be executed by git checkout -- <file>

From the header of SOURCE CONTROL tab you can capture the state of the project. Click on the tick button to commit your change after filling the message. git commit -m "my message"

the third dots button display all the commands as shown below.

You can push your commits to upload local repository from Smartface Terminal.

If you use https connection, your credentials will be asked before you can push to the remote url.

To bypass this behavior, you can edit your remote URI to https://<username>:<password>@<restofuri>. However, this method is strongly discouraged since your credentials will be exposed to any kind of attacks. To not enter your credentials every-time you push to the remote, read along to configure your SSH key.

SSH Keys

Git repositories require http or ssh to connect them. In order to complete the ssh setup, you need to have a ssh key and register that ssh key to your Git, Bitbucket or similar services. You can easily get your ssh key from the Smartface Cloud IDE.

Getting SSH Key from Smartface Cloud IDE

Your user on Smartface Cloud IDE generated an SSH key-pair itself upon your first project creation. Consider this key as your SSH key on your local machine. You can generate more or use the pre-generated key however you wish.

After you create your first project, open the command pane:

  • On Mac, the shortcut is cmd+shift+p

  • On GNU/Linux or Windows, the shortcut is ctrl+p

Type ssh in the command and navigate to SSH: view public key... as shown below:

This will show your existing SSH keys:

Since we didn't create any, the default SSH key which is created by Smartface Cloud IDE will be shown. The number refers to EPOCH timestamp which points to when this key is created. You can change the name if you prefer to create a new key.

When we click on the key, a new file will be opened which shows the public key, which we can use as credentials for your git provider.

You can also upload your existing key to Smartface Cloud IDE. However, for security reasons, Smartface recommends to keep a separate key for Smartface Cloud IDE.

How to Supply Your Key to Your Git Provider

If you are switching from https to ssh, do not forget to change your git url on your git config.

After we are done getting our public key, it is time to use it in your preferred git provider:

If you use self-hosted git provider, contact your IT Administrator to add your public key to the server.

With this method, Smartface Cloud allows you to create new app projects from private repositories using SSH connection. After the SSH key import process, these repositories can also be accessed without additional authentication so that you don't need to supply credentials for commands such as git push, pull, fetch, etc.

Warning

Please be aware of the extent of the direct repository access while using collaboration in your app project. Once you are connected to your repository through SSH, your collaborators won't need confirmation to use commands such as git push, pull, fetch, etc. for your repository. You can consider collaboration as a way to share your personal development environment.