Skip to main content

How to add an existing project to a GitHub Repository

 Add Existing project to a GitHub Repository


Step 1: Login into your GitHub account and create a new repository.


Step 2: Go to your project folder on your machine and open git bash. After that runs the command “git init”. This command initialized the empty git repository on your local machine.


Step 3: Create a file “.gitignore” using the command “echo > .gitignore”. Add the file extension or file name inside this file, those you don’t want to commit to your repository. Git will ignore all those files that will be present inside this file.


Step 4: Add all the files to the staging area using the command “git add .” This command adds all the files to the staging area and all these files are now ready for the commit. And with the help of the command “git status”, you can check that all the files are inside the staging area. Also, you can see the file extension or the file name mentioned inside the “.gitignore”  are ignored by git.


Step 5: Commit the files that are present inside the staging area using the command git commit -m “The first commit.”

For crosscheck run command “git status


Step 6: Now we have to push all these changes to the remote git repository that we have created in the first step. So copy the highlighted URL of the created GitHub repository and use this in the mentioned below command.

Use the command git remote add origin https://github.com/jdamit/jpa_criteria_api.git

Now the remote repository is added successfully.


Step 7: Now push all these changes to the GitHub remote repository using the command “git push -u origin master


Step 8: Verify this by going back to your GitHub account.


Thank you, guys. Please do comment below if there is any query or feedback.

Comments

Popular posts from this blog

Lambda Expression

What is Lambda Expression? In java 8, a powerful concept is added named Lambda Expression.  Lambda expression is an anonymous function (a nameless function that does not have a modifier, return type, and even the type of its arguments).  Lambda expression is that you can pass to a method whose argument type is functional interface i.e. an interface that is either annotated by @FunctionalInterface  annotation e.g. interfaces from java.util.function package, or an interface with a single abstract method e.g. Comparable, Comparator, Runnable, Callable, ActionListener, etc.  Lambda expression allows passing customized code to the java method that was not possible before java 8. Although before Java 8 the only option was to wrap your code as an object and pass it using anonymous inner class to the method. Lambda expression defines parameters and code that executed using those parameters. Let's take the simplest example of the lambda expression (String input) -> ...

How to install IntelliJ IDEA on Windows?

System Requirements and steps to install IntelliJ IDEA on Windows System Requirements:  Step 1: Download IntelliJ IDEA. Click here. Step 2: Run the downloaded exe file and click on next. Step 3: Check the checkboxes mentioned in the below image and click on next and then hit the install button. Step 4: Final step is to reboot your system before start using IntelliJ IDEA. Thank you, guys. Please do comment below if there is any query or feedback.