Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
GitHub is a great tool for collaboration and no fuss version control. But sometimes you want to be able to work on a project from any computer connected to the Internet or you just don't want to set everything up on your own computer. Workspaces is a wonderful way to have a development server while you're a Treehouse student. Let's see how to use both of these powerful tools together.
If you want something more in depth about Git itself, check out our Git Basics course. It's a great guide to using Git for version control.
If you need more information about using GitHub, both solo and as part of a team, check out the excellent GitHub Basics course.
-
0:00
[MUSIC]
-
0:04
Workspaces is one of my favorite features here at Treehouse.
-
0:07
It combines a terminal, a file browser and a text editor all into one and
-
0:11
even let's me run a server like when I'm using Django and Rails and see the output.
-
0:16
I've been lucky enough to use it almost everything I've taught and
-
0:19
I have no plans on stopping that anytime soon.
-
0:22
One of the questions I've been asked several times,
-
0:25
though is if you have to give up workspaces to be able to use GitHub.
-
0:28
This question has a surprisingly tricky answer.
-
0:30
If you're to the point where you want to put your work up on GitHub, you're
-
0:33
probably to the point where you should be working locally most of the time.
-
0:37
Development will probably be faster for
-
0:39
you, you'll be able to use your favorite tools and some workflows will work better
-
0:42
on your computer than they will on the Workspaces server, but you don't have to.
-
0:48
If you love Workspaces or need to be able to work on something from any computer
-
0:51
that's connected to the internet, you can stick with Workspaces and
-
0:54
take full advantage of GitHub.
-
0:57
Let's go to the source, Workspaces and see how to use it with GitHub.
-
1:01
Just like working with GitHub on your own computer,
-
1:04
the first thing you probably wanna do is create a repo.
-
1:07
Now, I can do this in Workspaces or I can do it on GitHub itself.
-
1:12
I don't really have a preferred way, so
-
1:14
I kinda just do whichever one seems more expedient at the moment.
-
1:17
So, I'm gonna start on GitHub.
-
1:20
So here, I am on github.com as you can already see.
-
1:24
And up here on the top, there is this plus button.
-
1:27
And if you're on your profile page,
-
1:29
there's also this newer repository button down here.
-
1:32
So I'm gonna click the create new and I'm gonna choose new repository and the button
-
1:37
might be in a different spot, just because GitHub does change their UI around.
-
1:43
I always end up having to look for it.
-
1:45
If you can't find it, there is a link down here to Help and
-
1:48
they have really good help documentation.
-
1:51
So, I need to name this repository.
-
1:54
I think I'm going to make a little reminder script.
-
1:57
Like something that I can use just to, hey, remind me to take out the trash.
-
2:01
Remind me to write that documentation.
-
2:03
Remind me to release a course.
-
2:05
So I'm gonna name that rememberer, cuz it does my remembering for me.
-
2:12
If you don't have a name, then GitHub actually gives you one,
-
2:15
which is kinda cool.
-
2:16
So potential-octo-adventure, that's actually a really great name.
-
2:20
Anyway, so for the description,
-
2:23
I'm gonna give it a quick description of what it does.
-
2:27
Lots of times people leave projects without a description.
-
2:29
That just really annoys me.
-
2:31
I'm gonna say, remembers things for you so
-
2:34
you don't have to and I'm gonna make the repository Public.
-
2:39
We have to pay for private repos.
-
2:41
If you don't have them, then you'll have to upgrade your account.
-
2:44
I don't care if anybody sees those codes, I'm gonna make it public.
-
2:47
I'm gonna go ahead and initialize it with a README,
-
2:50
just so there's a file in there and I'm going to, this is going to be python.
-
2:54
So, I'm gonna add a python get ignore.
-
2:57
And for licensing, I'm a big fan of the BSD 3-clause, but the MIT.
-
3:03
I mean, all the licenses are okay, so pick whichever one you want.
-
3:06
So I'm gonna do that, just because I wanna get this stuff in there.
-
3:10
So I'm gonna create that repository and cool.
-
3:15
So there's my repository and up here for cloning,
-
3:19
there's an address here and you can choose to do it between HTTPS or SSH.
-
3:26
The HTTPS one is a little bit easier,
-
3:29
you don't have to deal with SSH key and a passphrase.
-
3:32
So, I'm just gonna go ahead and copy that to my clipboard and
-
3:37
then I'm gonna come over here to Workspaces.
-
3:40
And I've already clicked the new Workspace button, so I'm gonna go ahead and
-
3:44
make a new Workspace now and I'm gonna say, it's the Rememberer Project and
-
3:48
I'm building this in Python.
-
3:50
So, I'm gonna put Python there.
-
3:51
Now of course, whatever language you want to use, go for it.
-
3:55
You don't have to do this as Python.
-
3:57
You can do this as anything you want and then I'm gonna hit create Workspace.
-
4:02
So, awesome.
-
4:04
Now, we have a great Workspace.
-
4:08
Let it spin up and then let's see.
-
4:12
Down here in this bottom part, this is my terminal.
-
4:16
So down here's where I wanna clone, I wanna check out my project.
-
4:20
So I'm gonna say, git clone and
-
4:23
then I'm gonna paste in the repository
-
4:28
address that GitHub gave me, press Enter.
-
4:33
Wait for a second and then I'm gonna Refresh the sidebar and
-
4:37
looks like I have a Rememberer Project.
-
4:40
So, that's pretty cool.
-
4:41
I have my License file.
-
4:43
My God, shrink that down.
-
4:44
I have my LICENSE file and I have my README.md.
-
4:47
So, great.
-
4:48
There's everything that I was looking form, but
-
4:50
this README.md is really bare because it just started.
-
4:53
It doesn't really have anything impressive in it.
-
4:56
So, I'm gonna fill this out a little bit more.
-
5:00
Lots of times when I'm first starting on a project,
-
5:03
I like to do what's called read me driven development and
-
5:05
the idea is that basically, you write docs about how your project works and
-
5:09
then you write your code, so that your docs are telling the truth.
-
5:12
No one likes lying documentation.
-
5:15
So let's say, Usage and we'll say,
-
5:19
'remem take out the cat litter' and
-
5:23
that will add a new item to be remembered and
-
5:28
'remem --list'- print out the list of things to remember.
-
5:37
'Remem --delet 2'- delete
-
5:42
the item with index 2 and 'remem
-
5:47
--next'- print out the next thing to do.
-
5:54
That's a pretty good README.md.
-
5:56
I obviously, have quite a bit of work ahead of me.
-
5:59
But I have made a change, so I need to make a commit.
-
6:02
So, I'm going to come back down here to my terminal and
-
6:07
let's do git status and fatal.
-
6:10
Not a get repository, that's right, because rememberer is the git repository.
-
6:17
So, let's get into rememberer and
-
6:22
now, we can do git init.
-
6:26
That's not what I wanted to do, I wanted to do git status.
-
6:30
There we go.
-
6:32
So, I have this README.md file that has been changed.
-
6:37
So, I need to add that change in.
-
6:40
So I'm gonna add the READMe.md file and them I'm gonna do a commit and
-
6:48
I'll say, "add example usage to README".
-
6:52
And so now git doesn't know who I am,
-
6:56
so you might have to add this yourself.
-
7:00
And basically, you just want to copy and do what git has here.
-
7:03
So, I'm gonna do git config user.email "kenneth@teamtreehouse.com" and
-
7:09
you'll notice that git lets me do this --global and I'm leaving off --global.
-
7:15
The reason for that is the --global goes to the system wide git so
-
7:19
that it remembers who you are.
-
7:22
The system wide git isn't going to be the same from workspace to workspace.
-
7:27
So I want this to remember me just for the repo and
-
7:32
user.name will be "Kenneth Love".
-
7:37
So now, let's check out git status.
-
7:41
So our thing was added, but we haven't committed it yet.
-
7:45
So let's rerun our commit, cool.
-
7:50
So, we added the example usage to the README.md and
-
7:53
now I'm gonna go ahead and push these up to GitHub.
-
7:56
So I will get push origin master, which is the default and
-
8:01
now I have to put in a username.
-
8:03
GitHub is going to ask you for your username and
-
8:06
your password every single time and that's because GitHub on
-
8:10
Workspaces doesn't store your identity, which is a good thing.
-
8:15
It's fine, we don't want our identity store on Workspaces.
-
8:19
So while it's annoying to have to type those in, it's great for privacy.
-
8:24
So, it's okay.
-
8:25
It makes pushing a little bit tedious, what I normally do if I'm going to be
-
8:29
working in Workspaces is make as many commits as I can before I push and
-
8:33
I just push like when I'm pretty much done with something.
-
8:37
You probably don't want to do that with a team,
-
8:39
because your team is probably going to want updates more often.
-
8:42
But if you're working on a feature branch by yourself, it's not that big of a deal.
-
8:46
So, let's check out GitHub and see if my changes came through.
-
8:53
So, we have two comments.
-
8:54
And if I look at the README.md, then yeah, I have my stuff.
-
8:58
It's not formatted great, but it's there.
-
9:02
So now, it's time to actually go build this thing.
-
9:05
I probably wanna go fix my README.md, so
-
9:08
that it comes through in a better format, but it all works.
-
9:12
So I'm gonna go work on this,
-
9:14
I don't wanna keep the rest of you from the rest of your day.
-
9:17
So, I'll do that on my own and
-
9:18
you can go build whatever it is that you need to build.
-
9:21
Like I said earlier,
-
9:22
you probably want to work locally by the time you want to put work up on GitHub.
-
9:26
Go for it.
-
9:27
Installing Git on you computer is pretty straightforward.
-
9:30
But whether you use your machine or Workspaces, the important part
-
9:33
is building up projects on GitHub and helping others with their projects.
-
9:37
If you want to learn more about Git or GitHub,
-
9:39
check out our courses on each of those.
-
9:41
A link to them both in the teachers notes.
-
9:44
Good luck and I can't wait to see what you built.
You need to sign up for Treehouse in order to download course files.
Sign up