Sending Projects to GitHub4:13 with Ben Deitch
Hosting your projects on GitHub is a great way to share your code with others. In this video we'll see how to send our Android Studio projects to GitHub.
[MUSIC] 0:01 Hi, I'm Ben. 0:04 In this workshop, we'll learn all about how to manage our GitHub projects, 0:06 without leaving Android Studio. 0:10 Also, since Android Studio is built on top of IntelliJ IDEA, most of this 0:12 workshop should apply to IntelliJ IDEA for your Java projects as well. 0:16 This workshop will assume that you already have a good understanding 0:22 of the basics of Git and how to use GitHub. 0:26 If you're not yet familiar with those, I encourage you 0:29 to check out the Git basics course linked in the teacher's notes. 0:32 We'll also tackle how to fix some typical Gradle build issues, so 0:35 a little Gradle knowledge will be useful as well. 0:40 The first thing that we're gonna go over, 0:43 is how to send a project from Android Studio to GitHub. 0:45 In order to do that, we'll need two things, a GitHub account and a project. 0:48 Let's create a new project for this called GitHubTest and 0:54 accept all the default options. 0:57 Before we go on, let's quickly sync our project with Gradle. 1:04 We want to include the module files and version control, but they haven't yet 1:09 been created yet. 1:13 Syncing the project will create them for us. 1:14 That way, they'll be added to version control from the start and 1:16 we won't have to add them later. 1:19 Now that we have our project, we need to set it up with version control. 1:21 Let's go to the VCS menu, which stands for 1:25 version control systems, and select Enable Version Control Integration. 1:28 Since we'll be pushing this project to GitHub, 1:34 lets pick Git as the version control system and hit OK. 1:37 We now have a local get repository located in our project's root folder. 1:44 That's great, but 1:49 we probably don't want to version control every file in our project. 1:50 For example the build folder is recreated from source code 1:54 any time we build the app. 1:57 Since any contributors will just rebuild this, 1:59 we don't need to include this inversion control. 2:02 Let's change to the project perspective and add an appropriate .gitignore file 2:04 to tell Git which files and folders we don't want to include in version control. 2:08 It looks like Android Studio has already created a .gitignore file for us. 2:13 Let's open it. 2:17 Awesome, we're already ignoring all the appropriate files. 2:19 We can even see our build folder right here. 2:22 It also looks like there's a plug-in, 2:25 which can help us out with our .gitignore file. 2:27 Let's check it out. 2:29 Looks like it has some useful features. 2:32 It would be nice if we could tell which files and 2:34 folders are ignored just by their coloring. 2:37 Let's go ahead and install it. 2:39 We'll have to restart Android Studio to let the plug-in take effect. 2:43 This plug-in definitely isn't required. 2:47 So, if you don't want it, that's perfectly okay. 2:49 Cool, now the ignored files are grayed out so 2:56 we can easily distinguish them from the files included in version control. 2:58 We also give an appropriate icon for our .gitignore file. 3:03 We've created our local Git repository and 3:06 we've verified that we have an appropriate .gitignore file. 3:09 We are now ready to send our project to GitHub. 3:12 Let's go back to the VCS menu, and select import, and 3:15 diversion control, and then Share Project On GitHub. 3:18 Now we just login to our GitHub account. 3:25 Give a name and a description for our project and click Share. 3:32 This next dialogue lets us choose which files we would like 3:41 to include in our initial commit. 3:44 Just as we would expect, 3:46 none of the files specifies in our .gitignore are on this list. 3:48 We're fine to leave them all checked and hit OK. 3:51 Our project has now been showed to GitHub. 3:56 We can click on the link on the top right to see out project. 3:58 Remember, if you're using a free account this project is publicly available. 4:04 In the next video we'll go over the workflow for 4:08 making changes to an existing project. 4:11
You need to sign up for Treehouse in order to download course files.Sign up