Checking in first time code Edited

New user with SourceTree.  I created a project on GitHub and I'm trying to check my local repo in for the first time into the "empty" project.  It seems to be a bit of a chicken and the egg situation with the software.

Scenario 1:  In SourceTree, click on Clone.  Attempt to clone the "empty" GitHub into the "real-code" local Repo gives error:  Cannot Clone into Non-Empty Folder.

I can clone the "empty" remote GitHub repository into an empty folder but that is not going to do me any code because my local repository in "MY EXISTING" folder is where the "FIRST" incarnation of the code IS.

Scenario 2:  Click Create in SourceTree, create a repository on GitHub from local Repo.  Same Error.

Does SourceTree have a get-init function to initialize the existing folder and source for SourceTree/Git?

There are only so many buttons in SourceTree and for the most part there are no more to click on that I can see.  Exactly HOW are you supposed to do this?  How do you get the first code checked-in?  It kinda gives you a bad taste to immediately get stuck with new software for a common first time use scenario. 


1 answer

1 accepted

0 votes
Answer accepted

If my understanding is correct, you're trying to "upload" your repo from your local machine to Github, is this correct?

In that case, I'd just follow the instructions provided by Github on how to do so, and once Github has my project I'd use Sourcetree to connect between Github and local.

You can find Github's instructions at Adding an existing project.

Let us know if you have any questions!



Ana:  It was a mess.  I figured it out without your instructions but did roughly the same thing.  

I got it to work by dropping to the command line and doing a git init for my local folder.  This created the local repo which sourcetree really has no way to do natively do --- and "it should"!

So via the command line I had to do this:

cd existing_folder
git init
git add .
git commit

Now, that still won't do anything because there is still no way to directly merge the local repo you just created with the github remote repo because you can't checkout and commit the remote repo since the local repo is basically on a branch outside of SCC.  I had to checkout the remote, pull it, then rebase my local repo to it, then commit the whole thing. 

Really all of this should be ONE Single command called "check code in for the first time" to a remote Repo.

It is working now, but this "chicken and the egg" problem gives any new user the feeling that SourceTree is not ready for prime time.  Giving someone instructions to go to the command line for a GUI tool makes no sense whatsoever. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,214 views 4 2
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