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 220.127.116.11 (18.104.22.168) / 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?
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).
Happy Friday – Fun Day! I don’t know about you, but I have been giving everything I’ve got this week (and most weeks) and come Friday I look for unique ways to recharge my batteries - rest, relax, a...
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG