How to link existing git repository to new Stash instance without changing remote

Safir Salihu August 6, 2013

If I install Stash on a server and if I want to maintain my exisiting git repo on the server it is currently hosted, can Stash be able to access and manage it?

I do not want to change the remote on the exisiting repositories.

2 answers

1 accepted

0 votes
Answer accepted
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

Hi Safir,

Unfortunately not. Git has it's own internal repository directory where it manages things. Stash also needs to be able to intercept all calls to the Git repository to handle access management, support branch permissions and pull requests etc.

By 'changing remote' do you mean having to tell users of that repository to update their local git config? Or something else? Apologies if I've misunderstood the question.

Cheers,

Charles

Safir Salihu August 6, 2013

Hey Charles,

Your understanding is correct. I was trying to get away from a) having to migrate the source from one server to another b) to make the switch seamless to the end user (no local git config change).

- Safir

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

Hi Safir,

If you're making the leap to Stash them there really isn't a way to avoid that, unless the current Git URLs just happens to match what Stash is running under, which is unlikely.

If users are primarily using HTTP you _could_ proxy Stash with Apache (which you might be doing anyway) and create some temporary URL rewrites. I wouldn't personally suggest that, but it is an option.

Users only need to run 'git remote set-url origin http://stash/url/to/repo.git', once which I don't think is too painful?

Cheers,

Charles

Safir Salihu August 6, 2013

Hmm...We have 100+ repos and was thinking of potential impact. We have jobs that run based off these repos as well. My intention is to keep the exisiting git repo untouched. But seems like it is not possible based on your comments.

I am also looking at using Stash as just a webbased viewer that will feed off from our exisiting git server. I was thinking if this could be done in the background with a softlink or something...

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

Hi Safir,

We certainly would recommend that Stash be the primary hosting. We rely on push events to update our indexes, and things like that. You _could_ softlink them on the filesystem, but then Stash wouldn't know that things have changed, and would not function correctly in all cases.

Are you using HTTP or SSH for your builds? You could certainly haveyour current git server mirror what's in Stash, and then only people pushing would need to change their URLs (unless you also added HTTP rewrite rules in Apache).

Do you mind me asking what your primary function of Stash would be, if not Git hosting? Is it just a file browser? Would you be using pull requests? JIRA Integration?

Sorry I can't be more help.

Charles

Safir Salihu August 6, 2013

SSH for builds. At this stage I am evaluating Stash. I like the features that it has and was trying to figure out what it can do. I would like to leverage Stash to do all of the above you have mentioned.

I wanted to start off as a FileBrowser (no pull) wth the exisiting git server and carefully migrate.

Looks like the cleaner way to do is to move everything to stash. We are on gitosis currently.

Also another question - Is it possible to move repos in Stash between Projects?

Thanks for your clarifications. It helps!

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2013

Hi Safir,

Yeah SSH is a little harder to redirect than HTTP.

If you just want to play with Stash, you can certainly mirror your current repositories by pushing to Stash (that's the important part - softlinking wouldn't work). Either manually on your machine, or with post-receive script in gitosis. The important thing with any mirroring is that you only have one canonical repository, so it would be important that you don't push to Stash from anywhere else during that phase. You could start to then migrate the builds, and then users.

Currently you can't move repos between projects. You may want to vote for the following:

https://jira.atlassian.com/browse/STASH-2796

Good luck.

Charles

0 votes
childnode July 22, 2015

you should vote for https://jira.atlassian.com/browse/STASH-2714

 

in there, there are several workarounds / plugin solutions announced.

w.g.

You might have a look at https://marketplace.atlassian.com/plugins/com.englishtown.stash-hook-mirror or https://marketplace.atlassian.com/plugins/com.kostmo.stash.mirror-manager

Didn't tested any yet but sounds good wink

 

unwillingly you'll get into troubles. You users will clone and work on stash and someone has to push it back where it comes from - if any plugin is not solving this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events