clone got no files

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.

 

3 answers

1 accepted

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)

Yes, I'll get that posted shortly.

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!!

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. 

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 init git remote add origin git@{server}:{new repo name}.git git add . git commit -a -m "{message}" git push origin master:res/heads/master After 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}.git This 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 from inside 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 this in SourceTree. Is it possible? If yes, can you tell me step-by-step how? Thanks.

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.

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

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

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?

thank you for the vote up - solving the posting issue.

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.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

800 views 0 4
Read article

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