clone got no files
Asked by Paul Levin:

Please help. I am brand new to git and Sourcetree, and can not seem to get past the starting gate. I have 2 company private git servers that I just setup. Each has its own ssh key in order to access the server. I have configured an ssh config file on my mac for the 2 servers. Using the git command line I had created a new repository containing 2 files on one of the servers. I can now use the git command line to clone that repository to a new folder on my mac, using the alias in the ssh config file.

Now to use Sourctree. I click on New Repository, and select clone from url. I put in the git path into the source url and select a destination. Sourcetree says my path is a valid git repository. I click Clone and a second later a directory named the same as my repository is created in the destination directory I specified. But the 2 files ARE NOT THERE!

What am I doing wrong??? Some very detailed step-by-step instructions would be helpful please.


Answers:
author: Seth
body: Does SourceTree have a branch checked out after the clone? Could you post a screenshot of SourceTree's log view? (At least the graph and the branch list to the left of the graph)

comments: author: Paul Levin
body: Yes, I'll get that posted shortly.


author: Paul Levin
body: Just to fully document what I'm doing --Just to verify that the git command line is working, in a clean new directory, I ran the command: git clone git@Cifercom:test-repo.git.Note that "Cifercom" is an alias in my .ssh/config file, that specifies the private key to use.Start SourceTree, click "+ New Repository" button, click "clone from URL".Enter in the source url box: git@Cifercom:test-repo.git.Enter the path to a new empty directory for the destination path.In the bottom left of the Clone window, it shows that this is a Git repository.Click the Clone button.OMG. It worked this time. I'm gonna post this comment anyway, as documentation of the process to follow. I'd swear these are the same steps I followed Friday, but I did change the .ssh/config over the weekend. Maybe that was the problem. Thanks for your help!!


author: David Grani
body: I just got the same thing, cloned a repo from URL and it all seemed fine from within Sourcetree, but there were no files. Repeating the clone repo steps exactly the same with no changes anyway worked for me the 2nd time so it may just be an intermittent issue.


author: Tim Crall
body: What OS are the servers and your workstation? Are there any non-standard characters in the filenames?If you can clone with the command line and you're getting the "valid git repository" message in SourceTree but not getting the files, something a little bit out of the ordinary seems to be going on.


author: Hans Nijbacker
body: How did you create the original repositories? I suspect you only created local repositories. You can't clone local repos.

If you want to create a remote repo you have to create one with:

* git init --bare

Then clone this repo on a local system, add files and push them to the remote.

comments: author: Paul Levin
body: Hello Hans. First let me mention that I tried to reply yesterday and the forum wouldn't let me, saying that I was limited to one post every 24 hrs until I had 3 points.Of course, no where could I find any explanation of how to get points.What can I do to remove this restriction?Regarding the problem of cloning the repository on my server --From inside the top level directory of the tree I want in source control, I ran the commands --git initgit remote add origin git@{server}:{new repo name}.gitgit add .git commit -a -m "{message}"git push origin master:res/heads/masterAfter these commands I deleted the file tree that I just put on the server. Then I ran the command:git clone git@{server}:{new repo name}.gitThis got back all of my files. So I now deleted this tree again, and tried to clone the new repository in Sourcetree. I used the same server and repo name. Sourcetree made the top level directory but did not get the files.Due to this limitation of one post every 24 hrs, let me ask the another question.I would like to be able to create the repostory on the server frominside of SourceTree, without having to use the git command line commands.But since I am using my own server, I could not find any way to do thisin SourceTree. Is it possible? If yes, can you tell me step-by-step how?Thanks.


author: Paul Levin
body: Hi Seth, thanks for the comment. Since I'm new, I don't see how your comment helps me. In SourcTree I did type in the url, to clone my repository. SourceTree created a local directory with the name of the repository, but did not get the files from the server.


author: Seth
body: Sorry, I mis-read your second question. You cannot create remote repositories with SourceTree, except possibly through extended integration with specific hosts (Bitbucket, GitHub).


author: Seth
body: Also, I voted up your question. That should give you enough points to get past the 24 hour limit.


author: Paul Levin
body: Ok. I will have to always create my repositories manually with the git command line. Then can you help me with the first question. Why is Sourcetree not getting the files in my repository when I do the clone?


author: Paul Levin
body: thank you for the vote up - solving the posting issue.


Tags: clone

ssh