It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Safir Salihu Aug 06, 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
Charles O'Farrell Aug 06, 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.



Safir Salihu Aug 06, 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

Charles O'Farrell Aug 06, 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?



Safir Salihu Aug 06, 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...

Charles O'Farrell Aug 06, 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.


Safir Salihu Aug 06, 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!

Charles O'Farrell Aug 06, 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:

Good luck.


you should vote for


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


You might have a look at or

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

3,353 views 3 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you