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
Post a Comment