Jump to content
michalis

How to set up GitSync and perform first steps

Recommended Posts

I'm a newbie with both Git and Plastic.

I have to use Git for a project at work, but could not find any GUIs that worked nicely, so I decided to try Plastic (to take advantage of the nice interface and facilities that it offers) and use GitSync to remain compatible with the requirements at work.

I read the documentation (https://www.plasticscm.com/documentation/gitsync/plastic-scm-version-control-gitsync-guide.shtml#Thegitsync.conffile) that I could find about setting up a gitsync.conf file, and I created one such file with the following content (as I work with Windows 7 I saved it at: C:\Users\<username>\AppData\Local\plastic4):

[email-mapping]
<username_in_Plastic> = <email_in_git>

[submodules]
http://gitlab.<location_of_remote_git_server>/<my_project>.git -> <my_project>@localhost:8087 writable:true

The info in the [submodules] section above, represents the URL location of the remote GIT repository (hosted by GitLab). The example in the documentation appears to me to be a 'local' GIT repo (perhaps a clone of a remote repo which resides on one's own computer ???) so the format that I used above might be wrong. Should I first make a local GIT repo of the remote 'origin' repo and use the location of that in the [submodules] section above ?

I also created a new repository in Plastic with the name <my_project> at my local machine (localhost:8087) and brought it under revision control.

After I saved the gitsync.conf file (with the content as shown above) I did not notice any difference in the Plastic GUI. I tried to follow the instructions that I had found (same documentation where I found the info about the contents of the gitsync.conf file at: https://www.plasticscm.com/documentation/gitsync/plastic-scm-version-control-gitsync-guide.shtml#Thefirstpull) to define the mapping between the remote git repo and my local Plastic repo, namely:

For the new repository, I opened the Branch Explorer tab, right clicked and, in the context menu, I was expecting to find the options Replication > Sync with Git... (as shown in the screenshot) but they did not exist. The entire context menu was completely different than the one shown in the screenshot, as a matter of fact.

As I am new to both Git and Plastic (Perforce user in recent projects) I am pretty sure that I am doing something (or perhaps several things) wrong, so I would greatly appreciate any and every piece of advice!

Many thanks!

Share this post


Link to post
Share on other sites

Hello @michalis,

you will need to pull the " http://gitlab.<location_of_remote_git_server>/<my_project>.git " repository to your " <my_project>@localhost:8087 " Plastic repository. You can do it by rightclicking the branch (make sure you click a branch and not a changeset) or using a Sync view (http://blog.plasticscm.com/2011/08/this-is-how-i-use-synch-view.html)

Once you have the submodule imported you can pull the main repo (the one using the submodule) using the same system, a new sync view entry or using the branch context menu.

Please tell me if it helps!

Additionally to this I would like you to give a try to gmaster, it's a git client based on what we know about Plastic and it's made by us: https://www.gmaster.io/

 

Share this post


Link to post
Share on other sites

Hello @manu

thank you for your suggestions.

The problem I had, getting the 'wrong' context menu, was because I was right-clicking on the changeset and not on the branch (this distinction was not made in the instructions and, as my branch was empty, I must have been clicking on the single changeset that it contained every time). Once you made it clear, with your suggestion, the gitsync worked successfully.

Following that, however, I found that subsequent 'pushes' to the remote GitLab repo were not successful. Here is what I did:

Added some files to my 'local' repo and, with the help of Plastic, I added them and then checked them in. I now had a branch with 2 changesets showing in the Branch Explorer. Following that, I repeated the earlier process to try and 'push' the new version onto the remote GitLab repo. The gitsync action run, reported success, but there was nothing on the GitLab server (i.e. it had not been updated with the new files). Could there be something wrong with my settings in my gitsync.conf file?

I have also started playing with gmaster, thanks for your suggestion. The few things that I have tried so far, all worked fine. As this is still in beta and as it only works with Git, I would prefer to work with Plastic (as long as I can find a solution with my gitsync problems ;-)

 

Share this post


Link to post
Share on other sites

Hi @michalis,

52 minutes ago, michalis said:

The problem I had, getting the 'wrong' context menu, was because I was right-clicking on the changeset and not on the branch (this distinction was not made in the instructions and, as my branch was empty, I must have been clicking on the single changeset that it contained every time). Once you made it clear, with your suggestion, the gitsync worked successfully.

It's a common issue for newcomers, not a problem once you know where to click :)

52 minutes ago, michalis said:

Added some files to my 'local' repo and, with the help of Plastic, I added them and then checked them in. I now had a branch with 2 changesets showing in the Branch Explorer. Following that, I repeated the earlier process to try and 'push' the new version onto the remote GitLab repo. The gitsync action run, reported success, but there was nothing on the GitLab server (i.e. it had not been updated with the new files). Could there be something wrong with my settings in my gitsync.conf file?

Can you double check the GitLab repository? GitLab/Github/Bitbluckes sometimes they take a few minutes before showing the new changes.

If it keeps failing please tell me if there is something special in your gitlab account so I can test the same, it's strange since the operation didn't report issues...

Did you manage to pull the submodule to a plastic repo too? If I correctly understood you have one git repository targeting a submodule, right?

55 minutes ago, michalis said:

I have also started playing with gmaster, thanks for your suggestion. The few things that I have tried so far, all worked fine. As this is still in beta and as it only works with Git, I would prefer to work with Plastic (as long as I can find a solution with my gitsync problems ;-)

Happy to know it worked! I'm afraid it's "only" a git client, for Plastic you have the Plastic client that is able to talk git :)

 

Share this post


Link to post
Share on other sites

Hi @manu,

I just checked the GitLab repo again, but it is still empty.

One point of confusion for me was that the GitLab repo is only available to me either under an SSH link (gitlab@gitlab.auk.cvclab.lan:CSAS/streamB/test.git) or under a URL (http://gitlab.auk.cvclab.lan/CSAS/streamB/test.git ) but the information in the instructions about how to set up the gitsync.conf file, suggests entries, in the [submodules] section, in the form:

git://localhost/code -> code@localhost:8084

I don't know if I've got the wrong end of the stick here, but neither of the above 2 formats (SSH or http://) seems to me to be compatible with the format needed in the [submodules] section. Please correct me, if I am confusing things here.

Taking it step by step (while performing all the actions listed below, my gitsync.conf file included the following in the [submodules] section:

git://localhost/test -> test@localhost:8087 writable:true):

- I used the following command (at the shell) to clone the remote GitLab repo to my local machine: git clone http://gitlab.auk.cvclab.lan/CSAS/streamB/test.git

- The above generated a local (empty) repo on my local machine (/test)

- I then created a Plastic repo on my machine (test@localhost:8087).

- I then git-synched (as per the instructions) the Plastic 'local' repo (test@localhost:8087) with the http://gitlab.auk.cvclab.lan/CSAS/streamB/test.git   The synchronisation was reported as successful.

- Next, I created a new workspace (called it "test") for my local Plastic repo (test@localhost:8087) and assigned it to a local directory /plastic_test_worksp

- Working at the shell, I then created an emtpy file (.empty) at the /test directory on my local machine. This file was created (with the 'touch' command) but not 'git added' or 'git committed' yet.  At this stage, there were no items to be seen in my "test" Plastic workspace. I conclude from this, that my Plastic workspace ("test", located at /plastic_test_worksp) was not communicating with my local git repo (at /test).

- I performed another git-sync (as above). Still no apparent communication between my Plastic workspace and my local git repo.

In conclusion: I am confused about the connection between the git remote repo (on GitLab), the git local repo (at /test), the Plastic local repo (test@localhost:8087) and its workspace (at /plastic_test_worksp); also what role do the entries in the [submodules] section of the gitsync.conf gile play in this whole thing? and how should I set them up?

I apologize for the long message, but because of my inexperience, nothing is 'obvious' to me and unless I take the whole process step by step, I will not understand it.

Many thanks

Mihail

Share this post


Link to post
Share on other sites

Hi @michalis,

If you are not using git submodules in your "http://gitlab.auk.cvclab.lan/CSAS/streamB/test.git " repository you can remove the following config:

2 hours ago, michalis said:

git://localhost/test -> test@localhost:8087 writable:true):

This is only needed when you are gitsyncing a git repository using submodules. The sub-modules are specified inside the gitsync.conf  file. git://localhost/test is not a valid git repository, it should be something like: http://gitlab.auk.cvclab.lan/CSAS/streamB/test.git  but as I said in your case is not needed.

If you want we can schedule a fast online meeting in order to review your setup. Let me know if you are interested.

Share this post


Link to post
Share on other sites

Hi @manu,

Thanks for your quick response!

I think that some interactive communication would be the best way to resolve this issue as quickly as possible. How do you propose that we set up such on online meeting?

Michalis

Share this post


Link to post
Share on other sites

Hi @michalis,

sure let me know your time zone and availability.

Remember, if your Git repository is not having submodules remove the submodules configuration from the fitsync.conf config file. Then create a new Plastic SCM repo, right click the branch and pull from GitLab, then perform a few commits and try to push them.

Share this post


Link to post
Share on other sites

Hi @manu,

sorry for taking this long to come back to you. Emergencies at work!

I have commented out the whole [submodules] section in my gitsync.conf file. I have also deleted the previous "test" repo and created a new one. I do not follow the process from that point onwards, however  (about pulling from GitLab, etc.); I right clicked on the branch (in Branch Explorer) and selected the option "Replication>Pull this branch..." but the dialogue did not allow me to enter my URL from GitLab (http://gitlab.auk.cvclab.lan/CSAS/streamB/test.git) as it expected a "server" and a "repo" entries.

Anyway, hopefully we can sort this out in the online meeting.

My time zone is Central European time (based in Vienna, Austria) and I am available as follows:

- today: the rest of the day

- tomorrow: only in the morning

- Friday: the whole day

I usually take a break between 12:00 and 13:00 (CET) every day.

Hope to online-meet with you soon!

Many thanks

Michalis

Share this post


Link to post
Share on other sites

Hello @manu

I have been busy with other project issues, so I apologize for not responding earlier.

Anyway, the issue is still here. I have deleted the "test" workspace that I had and generated a new one. I sync'ed with Git, everything reported to have gone OK. I then added a new file to the workspace, checked it in, (see the screenshots) and then repeated the sync with Git process. Everything was reported as successful (see screenshot 1) but when I checked back the GitLab server, there was nothing (i.e. the server was still empty, it did not know about the file that I had added).

Is your offer for the online meeting still on? I could take part any day, any time, until the end of this week.

Many thanks!

Michalis

2017-12-19.Plastic SCM_sync_with_Git.screenshot1.png

2017-12-19.Plastic SCM_sync_with_Git.screenshot2.png

2017-12-19.Plastic SCM_sync_with_Git.screenshot3.png

Share this post


Link to post
Share on other sites

Hello @michalis,

I've just tested the GitLab portal, I've created a new account and a new repository online, I then pushed from plastic a single cset to gitlab and I can correctly see it.

I had exactly the same output as you had so I'm wondering if something is happening at your hosted gitlab end. Do you have access to the gitlab logs? Maybe we can find more info there... from the Plastic point of view everything seems to be working just fine.

Share this post


Link to post
Share on other sites

Hi @michalis,

I'm not very familiar with GitLab but since you have it hosted maybe you can debug the Plastic SCM push and check if GitLab is having troubles receiving it... I don't know where that info might be written but I'm sure it has to be somewhere since Plastic is reaching the GitLab server and it's not complaining about connectivity or credentials.

Share this post


Link to post
Share on other sites

 

How do I set up a sync view for a git repo?

@manuYou said:

On 11/27/2017 at 5:10 AM, manu said:

Hello @michalis,

you will need to pull the " http://gitlab.<location_of_remote_git_server>/<my_project>.git " repository to your " <my_project>@localhost:8087 " Plastic repository. You can do it by rightclicking the branch (make sure you click a branch and not a changeset) or using a Sync view (http://blog.plasticscm.com/2011/08/this-is-how-i-use-synch-view.html)

I am not able to follow your instructions to set up a sync view with a git repo (as you indicated is possible above). It seems to work with other Plastic repos only. I am using https (instead of http as in the example above) to connect to a git repo and it tells me it's not a valid server (it expects server:port format).

Share this post


Link to post
Share on other sites

Hi  @CG,

I'm not sure why I suggested the Sync view there as it's not able to cope with Git repositories, just Plastic SCM ones.

Sorry for the confusion.

Share this post


Link to post
Share on other sites

@manu I thought that was the case but after seeing your earlier post thought maybe I was doing something wrong. Thanks for the clarification.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×