Git integration with theia

Hi all,

I tried to use git features in theia as follows:

  1. Run theia using command line yarn run start in terminal in root folder and open localhost:3000 in browser
  2. Clone some C (or any other project) project from Github into local pc
  3. Open the project using menu item “File->Open Workspace”
  4. Open a file and modify it
  5. Open SCM view using menu “View->Source Control”
  6. Stage the changes that were done
  7. Click on “…” icon in SCM view and choose menu item “Push”

=> I noticed the user name and password prompt is shown in the command prompt in terminal window (from where theia was run). I was anticipating that some UI will be shown for getting user name and password from the user.

Could you kindly let me know if my understanding is correct?
How can I ensure that the user name and password prompt is shown in UI ?

@rs do you mind sharing additional information, namely what prompt did you notice in the terminal.

In addition, please share what you are expecting to see as UI, perhaps by sharing a screenshot of the same scenario in vscode (if they have such a prompt).

Thank you, @vince-fugnitto. Kindly refer to the following image that shows the user credentials input in the terminal window behind the browser. (That terminal window runs theia using theia run start)

@vince-fugnitto, kindly refer to the following images …

Left hand side window is the theia src code open in VSCode. yarn run start was run in the VSCode terminal.
Right hand side window is theia IDE shown in the browser.

  1. When I tried Push, a message popped up in VSCode:

  2. when I clicked on the button Allow, i was taken to a github authorization website as shown below and I had to copy-paste the code to the input prompt (at the top) in VSCode window:

  3. After this, I copy-pasted the code into the input prompt in VSCode window and the Push was successful.

So, here is the question …

Instead of the workflow described above, is it possible to prompt for github credentials (user name and password) in Theia view (in the browser where it runs) and then use the credentials to Push the code to github repo ?

@vince-fugnitto, kindly let me know if you need further inputs.

Prompting the username and password is supported in Electron only. See here. You can get inspired from the existing code and make it available in browser too. Please note, if you are not using https, your password will go through the wire as a free text.

Thank you very much, @kittaakos.

Could you kindly clarify this. Sorry I’m not an expert in this subject …
Lets assume that my application’s url is https://www.my-che-theia-ide.com/ (pls note https). In this case, hope the password won’t go as free text ? Is this what you meant ?

Yes.

Thank you, @kittaakos.
So, if my application’s url is https://www.my-che-theia-ide.com/, then it is okay & secured, right?

Thank you very much for inputs, @kittaakos, @vince-fugnitto.

I tried reusing electron app’s git support as it is:

  1. Added the following in frontend module init:
export default new ContainerModule((bind, unbind, isBound, rebind) => {
    ...
    unbind(GitPrompt);
    bind(GitQuickOpenPrompt).toSelf().inSingletonScope();
    bind(GitPrompt).toService(GitQuickOpenPrompt);
    ...
}
  1. Added the following in backend module init:
export default new ContainerModule((bind, unbind) => {
    ...
    unbind(GitEnvProvider);
    bind(ElectronGitEnvProvider).toSelf().inSingletonScope();
    bind(Askpass).toSelf();
    bind(GitEnvProvider).toService(ElectronGitEnvProvider);
    ...
}
  1. In one of the frontend view, instantiated:
    @inject(GitPrompt) protected readonly prompt: GitPrompt

Now, when I modified a file, commit, stage and push the changes to remote, theia shows the prompt/input dialog on top so that I can provide the remote url, user name & password.
:+1:

Hope this is okay? Do you foresee any other issues with this (assume that my application would be behind https… i.e., like https://www.myapp.com).