Add existing remote repository and clone?
Asked by oyvindstromsvik:

Bear in mind I just started using git yesterday so this may be a stupid question, but why isn't there an option to add an existing remote repository and an existing clone in Sourcetree?

I work with web development (Drupal) and at work we've been using SFTP until recently when we started using git for some projects, but I'm no good with the terminal and prefer a visual interface like Sourcetree. Problem is it seems to require me to clone the remote repository on my local harddrive. I work equally from home and work so that would be impractical. It would also require me to export and import the mysql databases (some of which are huge) as well as install apache, mysql etc. on my work stations which I would like to avoid.

We host both the live site and test site remotely so if it was possible to add the live site as the repository and the test site as the clone in Sourcetree that would be amazing.


Answers:
author: stevestreeting
body: There are actually lots of ways to clone a project in SourceTree:

1. In the bookmarks window, hit the 'Add Repository' button in the toolbar and enter / paste the clone URL
2. File \> New achieves the same thing
3. Drag / drop a URL from your browser on to the bookmarks view
4. Open Hosted Repositories (the repo-and-globe button on the bookmarks toolbar, or View \> Show Hosted Repositories), and enter your Bitbucket / GitHub account details to automatically query these services for repositories you own or follow, then double-click entries to clone them

comments: author: oyvindstromsvik
body: Thanks for the reply, but I don't want a local clone of my repository. I already have the clone and it's on the same remote server as my repository. I just want to use SourceTree with that already existing remote clone.

All your suggestions would result in a local clone on my own computer. That's no good as I don't have the database, apache or mysql installed on my computer.

My current workflow is:

1. Log onto the test server with SFTP using transmit.
2. Edit the files I need to edit in the already cloned repository (which is the test site)
3. Now I need to open terminal and write all the git commands I would like to use SourceTree for to push my changes to the live server and live site.

None of the GUI applications I've tried (Tower, SmartGit, SourceTree) seem to offer a way to work entirely on the server. I don't understand why that's not possible. :/ Especially not when it's so trivial to do in the command line.


author: stevestreeting
body: This is simply not how distributed version control systems work. If you want to work entirely on the server, you'll have to use a terminal like you're doing now. The advantage of a DVCS like git is local flexibility and speed, if you do everything on the server you lose those advantages and therefore there's absolutely no point using them.

Most people doing what you're doing use a system where they commit files locally then push the commits to a server that does the deployment as a post-push, e.g. Heroku.


author: oyvindstromsvik
body: This is still confusing to me as I would like to think that my current workflow has all the benefits of git with the added benefits of working on the server. At least the more experienced people I work with seem to think this is the best workflow, but they also prefer the terminal and don't need a GUI application for git so the fact that everything is on the server doesn't affect them. :p

We still branch and clone and use all those features of git, but it's all on the server.

If I have to clone locally all the time I need to export big databases, mimic the server setup locally, and I wouldn't be able to continue my work from home as it's not available on the server, but instead recides locally on my work computer.

But thanks again. I guess there isn't a GUI option for me at the moment so I'll just have to get used to the terminal. :p


Tags: clone

repository