1 00:00:00,090 --> 00:00:06,090 In this video, I want to show you option two for getting your code up on GitHub or connecting a local 2 00:00:06,090 --> 00:00:07,710 repo to a hosted repo. 3 00:00:07,740 --> 00:00:09,350 Starting from scratch. 4 00:00:09,360 --> 00:00:13,600 So this works if you haven't started your work on your project at all. 5 00:00:13,620 --> 00:00:18,660 You know you want to use GitHub and you know you need to get repo on your machine, but you don't have 6 00:00:18,660 --> 00:00:20,520 an existing project to push up. 7 00:00:20,820 --> 00:00:25,200 So we can start on GitHub, we can make a brand new empty repo on GitHub. 8 00:00:25,290 --> 00:00:26,580 So that's what I'm going to do. 9 00:00:26,610 --> 00:00:28,680 Then we clone that to our machine. 10 00:00:28,950 --> 00:00:35,250 So I'd make it on GitHub, clone it down, and that act of cloning it down automatically configures 11 00:00:35,250 --> 00:00:38,760 the remote for me, so then I can do some work and push it up. 12 00:00:39,120 --> 00:00:40,410 So this will be quick. 13 00:00:40,500 --> 00:00:41,880 Let's make a new repo. 14 00:00:41,970 --> 00:00:47,220 Remember, you can do that by clicking new or by going to the plus sign new repository. 15 00:00:48,000 --> 00:00:49,260 I'll make this one. 16 00:00:49,260 --> 00:00:49,750 I don't know. 17 00:00:49,750 --> 00:00:51,150 How about chickens? 18 00:00:53,910 --> 00:00:56,310 Chickens, demo ock? 19 00:00:56,310 --> 00:00:58,920 And we can make it public or private. 20 00:00:59,700 --> 00:01:03,980 We will come back at a later point in the course to talk about Read Me files. 21 00:01:03,990 --> 00:01:05,450 We've already talked about getting more. 22 00:01:05,470 --> 00:01:12,330 So if you want to start with a get ignored file, we can do that on GitHub and clone that down or we 23 00:01:12,330 --> 00:01:13,620 can make our own git ignore. 24 00:01:14,040 --> 00:01:18,600 I'm just going to keep this simple and have an empty starter repository called Chickens Demo. 25 00:01:19,580 --> 00:01:20,300 All right. 26 00:01:20,420 --> 00:01:26,750 So now that I have this empty repository on GitHub, the next step is to clone it down to my machine. 27 00:01:26,750 --> 00:01:26,960 Right. 28 00:01:26,960 --> 00:01:28,340 So we've made this repo on GitHub. 29 00:01:28,340 --> 00:01:30,980 There's no corresponding repo on our machine. 30 00:01:30,980 --> 00:01:32,240 We clone it down. 31 00:01:32,450 --> 00:01:35,840 So to clone, all we need to do is copy this URL, right? 32 00:01:35,840 --> 00:01:42,140 So I'm going to copy that and then I'm going to go to my local machine. 33 00:01:42,140 --> 00:01:47,750 Let's back out into let's see, just the GitHub directory I made. 34 00:01:48,200 --> 00:01:49,580 I have this cloning directory. 35 00:01:49,580 --> 00:01:50,150 Sure. 36 00:01:50,150 --> 00:01:53,540 So in here type get status, we're not in a git repo. 37 00:01:53,570 --> 00:01:57,770 I'm now going to run git clone and then chickens demo git. 38 00:01:59,840 --> 00:02:02,900 And it tells me you appear to have cloned an empty repository. 39 00:02:04,160 --> 00:02:06,470 So we have a new folder called Chickens Demo. 40 00:02:07,310 --> 00:02:09,979 There's nothing in there, but it is a new folder. 41 00:02:10,340 --> 00:02:16,070 And if I type get status, it is a git repository and I don't have any work to push up. 42 00:02:16,070 --> 00:02:20,360 But we do have a pre configured remote called origin. 43 00:02:20,630 --> 00:02:22,140 So now I can do some work. 44 00:02:22,160 --> 00:02:24,320 Let's make a really simple file. 45 00:02:25,070 --> 00:02:32,060 Touch chickens dot txt and then we can open that up and put something in there. 46 00:02:32,330 --> 00:02:33,740 So here it is in my editor. 47 00:02:33,740 --> 00:02:37,220 Let's put one of my chickens, TV chicks in there. 48 00:02:37,370 --> 00:02:40,550 And then the Gray Lady slash Lady Gray. 49 00:02:40,550 --> 00:02:41,660 Another one of my chickens. 50 00:02:41,660 --> 00:02:43,610 Anyway, we have some contents in there. 51 00:02:44,090 --> 00:02:45,290 I'm going to add and commit. 52 00:02:45,290 --> 00:02:47,030 Pretend we've done some actual work. 53 00:02:47,030 --> 00:02:49,820 So get add chickens, get commit. 54 00:02:50,600 --> 00:02:53,870 Add my first two chickens. 55 00:02:55,600 --> 00:02:56,260 Great. 56 00:02:56,590 --> 00:03:01,800 If I refresh GitHub, nothing has changed whatsoever because I still have to push as we've talked about. 57 00:03:01,810 --> 00:03:02,990 So that's the next step. 58 00:03:03,010 --> 00:03:06,640 I've done some work, not a whole lot, but I've done some work locally. 59 00:03:06,640 --> 00:03:07,900 Now we push that up. 60 00:03:08,260 --> 00:03:11,160 So it's the same exact workflow from this point forward. 61 00:03:11,170 --> 00:03:17,470 The only difference between what I showed you earlier is that we cloned an empty repo and started working 62 00:03:17,470 --> 00:03:22,690 in that repo versus our first approach was we've been working on something locally. 63 00:03:22,930 --> 00:03:24,340 We have a bunch of commits. 64 00:03:24,340 --> 00:03:25,960 I want to get those on GitHub. 65 00:03:25,960 --> 00:03:27,880 So I'm not going to clone an empty repo. 66 00:03:27,910 --> 00:03:33,400 I already have my repo on my machine, so I make an empty repo on GitHub and then I configure a remote. 67 00:03:33,400 --> 00:03:36,760 So my local repo points to that GitHub repo. 68 00:03:36,790 --> 00:03:38,740 Anyway, I'm going to push. 69 00:03:38,740 --> 00:03:41,530 So it's just the master branch at this point, right? 70 00:03:41,560 --> 00:03:43,090 That's the only branch I have. 71 00:03:43,330 --> 00:03:48,700 In the next video I'll talk about Master and Main, but I just have the master branch. 72 00:03:48,700 --> 00:03:50,890 So get push origin master. 73 00:03:52,430 --> 00:03:54,350 Just one simple commit. 74 00:03:54,830 --> 00:03:57,680 If I refresh we see chicken. 75 00:03:57,890 --> 00:04:01,160 TXT is here and we have our one commit. 76 00:04:01,160 --> 00:04:04,660 Just one add my first two chickens. 77 00:04:04,670 --> 00:04:07,190 That's all the history we have on this branch. 78 00:04:07,190 --> 00:04:11,600 So that's just another way of connecting a local repo to a GitHub repo. 79 00:04:11,630 --> 00:04:14,080 Different approach, but then the same workflow. 80 00:04:14,090 --> 00:04:19,100 Once we have that connection established, do some work, add commit and then use push.