Share repo question

11 views
Skip to first unread message

will...@gmail.com

unread,
Oct 19, 2021, 2:50:53 PM10/19/21
to scmmanager
This may be more of a git question than scm manager question, but I think y'all may be able to answer it anyway :).

I have scm manager running on a server at home. I sync my laptop using git clone, push, etc. I have a desktop at work. I would like to clone my repo onto that desktop and synch it with my personal laptop, while at work and then sync as usual with my scm manager instance at home.

Visually:

Desktop -> Laptop -> Server

My problem is that I don't want to lug the desktop home to sync it. I tried the following:
git clone http://scmmanager on my macbook at home
git clone ssh://macbook:sandbox on my desktop
All swell until I tried git push on the desktop (complained about pushing to non-bare repos).

Is there a way that you know of to get my macbook to serve as an intermediary in the git push pull relationship?

Thanks,

Will

Rene Pfeuffer

unread,
Oct 20, 2021, 2:15:25 AM10/20/21
to scmmanager
Hi Will,

as git already complains, you cannot push to a non-bare repository. I don't know, whether there is an easier way, but you could bring a fourth repo into play: A bare one on your lappie (git init --bare /some/path). You can add this one as another remote to your working repo (git remote add worksync /some/path) and use this one on your desktop as a remote instead of your repo with the working copy.

Assuming the simple case that you only use a main branch, it could work like this (without guarantee, I haven't double checked the commands):

At home, sync both repos on your macbook (calls from the 'normal' clone):

git pull # sync with SCM-Manager
git push worksync main # sync bare repo

At work on your desktop:

git pull # will fetch the latest changes from home
# do some work
git push # will push changes to the bare repo on the macbook

Back at home on your macbook:

git fetch worksync # get changes from work into the remote branch
git merge worksync/main # merge them with your current main branch
git push # push them to SMC-Manager which is still the 'origin' remote

This will get a bit more complicated, when you use more branches, because somehow you have to merge them. If you do not create conflicts, you may skip the merge and push all branches directly using ref specs with wildcards (something like refs/remotes/worksync/*:..., I'd have to look these up).

Does this help as a first idea?

Kind regards
René

Will Senn

unread,
Oct 20, 2021, 12:02:11 PM10/20/21
to scmma...@googlegroups.com
Hi Rene,

This worked beautifully. Thanks for the idea.

Will
--
You received this message because you are subscribed to a topic in the Google Groups "scmmanager" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scmmanager/3q_oI3sr7TM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scmmanager+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scmmanager/2e269a89-4870-4094-afb3-3bb488fd8562n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages