I'm trying to learn GitHub, so I downloaded the necessary tools including SourceTree. The purpose is for learning only. But I ran into a stumbing block when it comes to creating a remote repository. Can I create one on the same machine as the local repository. It looks like I have to pay to use one on the GitHub server. But how do I set this up so that I can learn it locally on my machine?
-
https://try.github.io/levels/1/challenges/1 – René Höhle Feb 01 '16 at 16:45
-
1You shouldn't have to pay on Github if you create a public repository only for private ones. Since it's a learning exercise that shouldn't be a problem. – Anthony Feb 01 '16 at 16:46
-
1trying to learn github or git? – Mircea Feb 01 '16 at 23:15
-
If you want to use a remote git service provider you can also try bitbucket. They also have free private repositories. Furthermore, you shouldn't learn github/bitbucket/whatever but **git** and I strongly advise to familiarize yourself with the command line. – k0pernikus Feb 01 '16 at 23:35
-
@Mircea: What is the difference between Github and Git? – Ray Feb 02 '16 at 01:34
-
http://stackoverflow.com/questions/13321556/difference-between-git-and-github – Mircea Feb 02 '16 at 16:45
-
https://jahya.net/blog/git-vs-github/ – Mircea Feb 02 '16 at 16:45
3 Answers
Note that you can always host a "remote" repository on your local machine that your "local" repository (on the same machine) can treat as origin
. Simply go to c:\somedirectory and type git init --bare
. Then go to c:\someotherdirectory and type git clone c:\somedirectory .
. Then when you push and pull from the latter directory, it will be to/from the repo in the former directory.

- 17,443
- 4
- 47
- 54
-
+1 this is the way to go if you are playing around. once you clone it doesn't matter where the remote is. – Mircea Feb 01 '16 at 23:14
You can create a public repository on Github for free. Just create an account and follow https://help.github.com/articles/creating-a-new-repository/
Then you can clone the remote repository to a folder on your local machine using SourceTree.
If you already have a local git repository, you can simply set its remote path to your newly created Github repository using top right Settings button in SourceTree, then you can push changes to the remote Github repository.

- 11,112
- 2
- 21
- 42
Github team has a GitHub Overview Training video series that may be helpful to you https://www.youtube.com/playlist?list=PLg7s6cbtAD15Das5LK9mXt_g59DLWxKUe
You can create an open source repo on github for free, and then you can clone that repo down to your local, or if you already have an existing local repo you can do hook it up and push your local project to your github repo by doing the following
$ git remote add origin https://github.com/your-repo-link
$ git push -u origin master
By the way, Github has their own GUI tools https://desktop.github.com/ which I'd recommend over SourceTree.

- 12,101
- 27
- 95
- 137