Ok, this is a toal noob question. I must be missing something pretty obvious.
I'm using Coda to build web apps. I have git repositories in my local source folders that I now manage with SourceTree.
What's the SourceTree workflow to push a local repository to GitHub?
In SourceTree you can add a repository using the "Settings" button (top right):
Add a new remote repository and set the URL/path to your Github repository URL. The name can be whatever you want but for the default repository "origin" is a good option :)
The "Push" button in the menu should then allow you to select the repository you just added. Selecting the "Track" option will set up a tracking reference (it'll "link" your local branch to the given branch on the remote).
On the commandlone it looks like this:
git push -u origin master
git will automatically set up a tracking reference to that you can use git push/pull without having to explicitly add the remote and branch you want to push.
Yep there it is, you can do it all via Sourcetree
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Stefan! What puzzled me was that after creating a "hosted" repository using the Create Repository button on the View > Show Hosted Repositories dialog, when I clicked on the "Push" icon it only lets me sleect "Custom" repositories.
The Setings Icon certainly lets me do it. But... It's not the most obvious UI. I need to know that clicking on the little Globe button is how I get to see my "hosted" repository list.
Many thanks for helping a bear of very little brain.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can see why that might be confusing, it depends on how you got to the Create Repository dialog. If you got to it straight from the top-level hosted repositories view there's no link to any of your own repositories yet, which is why you have to then go into Settings in the repo to set that up. If you'd cloned the repo from GitHub then the remote would already be set up.
In future for new repositories, what you can do is go straight via Settings in the first instance, click Add Remote, and then click the 'World' icon, which brings up the hosted window again, but in the context of this repo. You can then Create Repository from here, and then select it to set up the remote. That way the process is a bit more seamless.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to add the github repository as a new remote.
So first create a Github repository and after creating it, it will show you a section with the commands to add it as a remote to your local repository
It will be something like the following from the commandline
git remote add origin git@github.com:user/repository.git git push origin master
When my mac reboots I'll see how to do that direct in sourcetree :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Colin! I saw the command-line instructions for git, but I'm trying to learn the SourceTree GUI. Stefan's answer seems to solve the problem. Thanks for helping!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you create a remote repository on Github/Bitbucket directly from SourceTree? I can't find a way to do this. And when I view hosted repos, the option to create new repository is blanked out. BTW I'm using OpenSSH, not putty, is there a reason for this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.