Checking in first time code

Michael Barber October 30, 2017

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
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 30, 2017

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!

Regards,

Ana

Michael Barber October 30, 2017

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
TAGS
AUG Leaders

Atlassian Community Events