We start with a project that is not currently under any source control, so there’s no Git or VCS tool window. So, first, we will create a local Git repository for this IntelliJ IDEA project. We often want to save our project’s progress each step of the way, for example, once the tests are passing. We don’t want to publish our project on GitHub just yet, but we do want to enable source control for it as we want to do small commits locally while we evolve the code. Let’s assume we have a more complex project than Hello World and that we’re still in the process of writing the code.
#Intellij gitignore code#
Often we’ll want to create a local Git repository for our project well before we want to publish our code publicly on GitHub. The first approach assumed we want to do everything in a single step. View previous steps in video Sharing Your Project on GitHub (Multi-step Approach) We can see the repository, the code, the commit message, and the description. When this process is finished, IntelliJ IDEA will pop up a balloon and we can click on the link to see the repository in GitHub in a browser. Under the covers, IntelliJ IDEA is creating a local Git repository for the project and then pushing it to your GitHub profile as a new repository with the details we just entered. gradle folder (if we’re using the Gradle wrapper), and we don’t need to add the build folder, which is where IntelliJ IDEA puts the compiler output like class files.Įverything else looks good to commit, we’ll use the default commit message and click Enter to commit it. We could commit everything, but generally we don’t need to add the. The IDE will ask us which files we want to put into this first commit. When we press Enter or click Share, IntelliJ IDEA will go ahead and create that repository on our GitHub profile. This isn’t mandatory, but it helps people who want to understand what the project is for. You can rename the remote if you like, but I will accept the default here. I like to make my repositories public, unless there’s a compelling reason to make them private. You can make this repository private if you like. For my Hello World project, I will call our repository hello-world-demo, as repositories have to have a unique name and I’m sure there’s already a repository called hello-world on my GitHub account. This defaults to the project name, but we can pick any name for this repository, as long as it follows GitHub’s guidelines. Once we’re successfully logged in, IntelliJ IDEA will ask us what we want to call the repository that we’re about to create on GitHub. Tip: if you have multiple GitHub accounts, you can add your GitHub accounts by going to the IDE Preferences -> Version Control -> GitHub. If you log in with your username and password, and have two-factor authentication enabled for GitHub, IntelliJ IDEA will pop up an additional dialog asking you to input your authentication code. If you don’t already have a GitHub account, you can use the Sign up for GitHub link in IntelliJ IDEA to create one.
#Intellij gitignore password#
This also provides the option to log in using a token from GitHub, but even if we don’t select that option, if we log in with our username and password here IntelliJ IDEA will generate a GitHub token and use that to log in. If we’re not already logged in to GitHub via IntelliJ IDEA, we’ll be shown a log in dialog where we can enter our GitHub username and password. We can use IntelliJ IDEA to share this project on GitHub, we can go to the VCS menu and select Share project on GitHub. It’s not currently set up with any source control, which we can see in IntelliJ IDEA because there’s no option for opening a Git window, and if we list the project’s files in the Terminal window, we can see there’s no. In this tutorial, we use a sample Hello World application that we know works because we’ve seen it run successfully. Let’s assume we’ve created an IntelliJ IDEA project containing the code we want to share on GitHub. Sharing Your Project on GitHub (Quick Approach) The second approach is multi-step which can be used when you want to create a local Git repository for your project separately from publishing any code publicly on GitHub. The first is the quickest where you create your local and remote repository in one step. In this blog, we will go over two approaches. There are a few ways to use IntelliJ IDEA to publish code that we’ve written on GitHub. This provides an easy way for people to skim the content quickly if they prefer reading to watching, and to give the reader/watcher code samples and links to additional information. This blog post covers the same material as the video with some additional tips and tricks.
#Intellij gitignore how to#
In this blog, we’re going to look at how to share code that we’ve written on our local machine to a repository on GitHub.