Setup Sourcetree to push on self-hosted repo


I know my question will sound stupid but I'm just getting started with git and I need your help.

I'm currently using Git with Bitbucket and Sourcetree and it's working perfectly.

Now I would like to be able to push my changes directly on the live website instead of pushing to our Bitbucket repo and then add the edited files 1 by 1 throught the FTP ...

I have the SSH credentials for my server and I tried a few stuffs but none are working. 


Could anyone help? That would be very nice smile


1 answer

SSH to you web server, change into the correct directory, and clone your git repo there.  Now you can update the webserver at any time by doing a "git pull" in that directory.  This would be the easiest way.

If you prefer to update it by doing a "git push" from your workstation, you should be able to do that as well.  Add the webserver as a second remote by using "git remote add webserver <url>".  It will take a little more work to get the paths and ports all set up correctly this way, though.

Hello Tim,

Thanks for your help.

How can I do that using Sourcetree ? I tried to log to my server using the command and it works, I tried to clone my repo and it worked as well BUT it creates a folder all the time like while I want it to be in the root. 

My goal is to have a working version on my computer where I will work on and then to push the changes on the repo on Bitbucket and on my server.


You can do "git clone <url> ." to clone into the current working directory without creating a subdirectory. In SourceTree, you can add a remote by going to Repository->Repository Settings

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,225 views 4 2
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you