Setup Sourcetree to push on self-hosted repo

Hello,

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

Thanks

1 answer

This widget could not be displayed.

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 http://www.mywebsite.com/myproject 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.

Thanks

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 May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

878 views 2 3
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