Pulling from remote (GitHub) to server

I have SSH access to my server and am cloning / pulling from a GitHub repository fine via command line, but I was wondering if there was a way for me to do all this via SourceTree (Version 1.7.4.1 (1.7.4.1) / OSX 10.9.2).

Cloning to a local repo, then adding my server as another remote would probably be the easiest (and I know how to do that), however I would like to be able to control when and what gets to this server, hence I'd rather use the copy on the server as a local repository pulling from the GitHub repository.

Is there a way to achieve this in SourceTree?

Thanks!

1 answer

1 accepted

This widget could not be displayed.

You might be able to acheive what you want by mounting your server's repo locally, but people have had a lot of trouble using SourceTree (or any other Git client) to treat network storage as a local repository (here, for example.

I would recommend using SourceTree to clone from GitHub locally, add your server as a remote, and push changes from your local instance to the server.

You would still have to use SSH access to keep the server's working copy up to date (git merge to pull changes out of the server's repo into working copy, or git checkout to switch branches).

So the jist of your answer is that it's not possible (or very difficult). Like I said, I know how to add another remote to SourceTree but that would basically push anything to both remotes (GitHub & the server) at the same time, correct? Can these 2 (GH and server) co-exist at all as remotes of the same repo?

You can almost certainly push to just one remote at a time or both, whichever you prefer for a given operation. Remember, Git was designed without any concept of a "central" repository. It is trivial to follow that kind of workflow using Git, but you can also have many remotes with the same repository and push/pull the same commits or different commits in any way you like.

I'd have one more question: I managed to setup my server as 2nd remote, however it's not updating the files on the server. One detail I haven't shared: I also would like to use my server location as the output of my local copy so others can test my online app / website. How can that be done with SourceTree?

To my knowledge, you can't make any changes to a remote's working copy in SourceTree, and probably can't in any other client either. You're better off using an IDE that will automatically FTP changes to a server.

If you want to use Git, you'll need to SSH into the server and run a git merge periodically (which will merge the changes you've pushed to that remote into the remote's working copy).

Thanks for your help!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

142 views 16 7
Join discussion

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