VCS - GIT

Hi, i’m searching information in Documentation / Forum to how to setup connection to GIT step by Step, but i can’t see a lot of info…

Can you provide a Guide to Setup Cuba and connect with GIT please?

Thanks!

1 Like

Hi,

its pretty easy actually and has nothing to do with CUBA in particular.

  1. create a new project in studio
    1.1. open a terminal, cd to you project root directory, “git status” --> fatal: Not a git repository (or any of the parent directories): .git
  2. studio > project properties > edit > VCS > select git > click OK
  3. open a terminal, cd to you project root directory, “git status” --> “on branch master…”
  4. git commit -m “initial commit”

ready is your git repository. Step 1 & 2 are just nicer way of doing a “git init” and add a git ignore file (as well as “git add --all”)
If you want to push it to something like github / bitbucket:
5. git remote add origin "remote repository URL"
6. git remote -v
7. git push -u origin master

bye,
Mario

Thanks!

works fine to Upload, and now, if i like to in my second laptop connect to repository, only need to copy my actual installation to other laptop and it’s all ok?

On another computer you’ll just do a git clone like this:

git clone https://github.com/mariodavid/cuba-ordermanagement.git

You’ll get a directory called cuba-ordermanagement and can just import it into studio.

Bye,
Mario

And all the actions can be make from IDEA ? Update, Download Changes…

There are no automation on Studio?

Yes, either from your IDE or your shell of choice. What studio does in the workflow is just doing a git add in case it creates or changes files. Thus in the next git commit the files will already be recognized and you don’t have to add them manually.

Thanks Mario!!
One Question, and sorry tor the actual time :wink:
Intellij Idea says :

Unlinked Gradle project?
Import Gradle project, this will also enable Gradle Tool Window.
Don’t want to see the message for the project again: press here.

it’s necessary to link Gradle?

Hi Ivan,
It’s not necessary, just ignore the message.

Hi,

I tried use git on the my Windows laptop but no chance.

I installed tha latest git for windows with default settings.
In the cmd.exe i can type git and it runs, but cuba studio is complains about not finding git.

“[20:58:25.628] ‘git add modules\web\src\web-app.properties’ launch error:
java.io.IOException: Cannot run program “git” (in directory “F:\work\CodeWizards\cuba\syncart”): CreateProcess error=2, file not found”

Did you re-launch the Studio server after installing Git? If not, it can not see the new value of PATH variable containing path to Git.