Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

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 ( / 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?


1 answer

1 accepted

1 vote
Answer accepted

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
Community showcase
Published in Atlassian Community Events

🏖 Lead a Virtual, honored and ACL life 👍

Hello dear ACE, It's an exciting context of #Atlympics for all community leader's. Have you ever wondered in the life of a person their comes a day, a month, a year working from home and: taking fu...

138 views 4 3
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