How to Push Project from IntelliJ to GitHub | Commit & Push code to GitHub| Pull changes in IntelliJ

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone so in this video we will see how we can push our Maven project from IntelliJ to remote repository like GitHub or gitlab so these are the prerequisite uh you need the git on your local machine so if it is not available you need to install git on your local machine then just create any one sample project in the IntelliJ that we already seen how you can create the main project in the IntelliJ and then uh before we push our project to the remote repository we need to make sure that project is available in our local gate repository okay so we will see how we can create the local gate repository uh and for pushing our project to the remote repository we need to set up the VCS integration okay Version Control System integration with the git and then we can push our project so to install the git on your local system just to go to the git official website and you need to download it as per your platform if it is Mac windows and Linux okay so just download the setup file so I have already downloaded it so you just need to install this git application now so this gate is required as we need to create the local git repo okay so without get a local Gator we cannot push our project to the remote repository okay so make sure you install the git on your local system so I have already created a sample my own project in the previous session so this project we are going to push to our remote Repository okay so for pushing your project from IntelliJ to GitHub or gitlab you have uh two different ways so first way is to go to VCS and here you will find this option enable Version Control integration okay so I will go here I will click on enable Version Control integration so you just need to select the version control system so as of now I will select the git click on OK so created git repository in this local project location okay that means it has created a empty git repository on the project location so my project is available on the local machine I will open it in the Explorer using this option show in Explorer okay so this is the git empty repository so this folder will be hidden so if it is not showing on your system just enable this checkbox hidden items okay so currently this local gate repository is empty so once we uh enable the VCS integration you will get different options over here commit update project like that okay and at the bottom of the window you will find this option as well git okay and here we have got the commit window so here at the right hand side you will see this is the master local branch and at the top hand side you will get different options also these are the shortcuts to commit and push the project okay so again I will go to the VCS go to git then use these remotes so we need to add the remote first click on the plus sign so here I will add my GitHub repository URL so I will first create a empty git remote repository in my GitHub account so I will click on new okay let's say this is my my app okay this should be a public repository and that's it create with a positive okay so this is the link or this is the URL I can use as of now Okay click on https and I will use this URL click on OK so URL is correct click on OK so now uh from this drop down okay uh you need to open this commit window here you will find the different files available in that my own project which are not a part of your git repository okay so I will expand it uh currently take it is showing under the unversion files okay so I will select this check box and I need to open it whatever important files are there that need to be committed in the gate so here you will get two options you can either commit okay commit means those files will be a part of your local repository first and second option is commit and push okay so those files will be first will be taken in the local gate repost and from here all those files will be posted to the remote repository as well okay so I will select this option commit and push okay so I need to specify commit message here so let me edit my first commit okay so again let's commit and push okay so contains problems no errors and warning form would you like to review them okay so it is asking me some errors are there and one warning found so I don't want to review it as of now so I will click on Commit and push so here you will find what are the different files that will be pushed to our remote repository so I need to push all these files means complete project to the remote repository so I will click on push directly okay so it is asking me login into the GitHub okay so you need to provide the credentials so you can use different options over here you can directly login into the login in Via GitHub or you can use the token okay so first let's see how we can use the login via GitHub okay so here I will use authorize in GitHub so I will click on authorize jetbrains so if you go to the IntelliJ it is still uh trying to login into the GitHub okay so I think uh this is already a known issue and uh we need to use the token for uh authorizing our commit so click on cancel so let's use the token for authorization so again I will click on the push click on push so this time I will use the use token okay so we need to generate the token first so that we will be able to push our project to the github.com okay so to generate the token I will go to the GitHub okay uh click on your profile go to the settings then scroll down below and here you will you will get the option developer settings uh click on the personal access tokens so click on generate a personal access token okay so expiration when this token will be expired after 30 days okay so you can say it uh as per your requirement I will select no expiration okay then below we need to add some Scopes over here okay so if you see in the IntelliJ it is showing here uh so this three scope we need to uh granted to access the token so git this one select the check box for repo then and this one okay so click on generate token now okay so this is the token generated I will copy this token okay and go to the IntelliJ and here I will add its value and click on login now so here you can see pushing the code and our code our project has been pushed from Master Branch to the new Branch origin master in our remote Repository okay so if you go to the GitHub again I will click on this I will click on Repository so my app was empty repository previously so as our project has successfully pushed from local to the GitHub you can see all the files are available here now okay so this is how you can create a integration between GitHub and your local so just generate the token by using your github.com and use that token to login into the GitHub in the IntelliJ so once it is added in the next time it will not ask you to add any token anymore okay so if you change anything from your project you can commit those changes again without any authorization so for example here let's say I added one statement okay so this is the file I have changed first test dot Java so click on the commit here find one file has been changed I will select that file uh I will second commit okay added my commit message and again from this drop down I will use commit and push so this is the file it is going to update into the github.com so click on push so this time I did not ask me any authorization and it has directly pushed my code changes to the github.com okay so you can verify those changes in the SRC folder first test so here you will find the commit message as well okay so this is how you can post the project from the IntelliJ to the GitHub using the login token So currently we have selected the master bench you can have different branches from the same project okay so if there are some changes which are there in the remote repository you can pull those changes using this option so whatever changes I am going to add here are not a part of my local Repository so I will commit these changes [Music] okay so this line or these changes are not available in my local repository so now uh just click on this option update project okay so merge incoming changes into the current Branch or replace the current branch on top of incoming changes so I am going to merge my whatever changes from the remote into the local directly okay so now you can see this line is available in my local repository as well okay so before you push any new changes from local to git uh remote repository you need to make sure you face the changes and merge into your current Branch okay otherwise it will give you the conflict and you will not be able to push the changes without resolving that conflicts okay so always take the uh changes first phase the changes or pull the changes update your local project in the integrity and then push whatever changes you are done to the remote repository so now let's see another way to push the project to the GitHub okay so we have used this enable Version Control option so there is another option we can use to push this project to GitHub so go to import into Version Control and here you will find this option share project on GitHub so if we click on that yeah it is saying that it is going to create a repository with this name at the GitHub account okay and remote will be origin you can provide any description over here okay which is optional and I will directly click on share so if you want to make this report as private you can select this checkbox otherwise that will be a public Repository okay so instead of creating the repository uh in the GitHub account by using these options you can directly push this project means share this project on the GitHub so I will click on share so as we have already uh added our token for login credentials okay previously so it will not ask you for any authentication okay so these are the files it is going to commit and this is my commit message I will click on ADD so it will directly commit all these files into local git repost and it will push the project to the GitHub okay so within a few seconds you can see it has successfully shared the project on the GitHub okay so if you go to the GitHub again just refresh the reposites and here you will find the new repository my app to has been created and it contains the project from the IntelliJ okay so you have two options to share the project under GitHub you can use the enable VCS integration or you can use the share project on the GitHub okay so for login purpose you can use the login token create the token in the GitHub and add that token in the IntelliJ and it will have some expiry so if you have set the expiry has no expiration then it will not ask you any authorization anytime okay so this is how we can share the project from IntelliJ to GitHub so how we can share the project from IntelliJ to gitlab we will see in the next session so thank you guys uh let me know if you face any issue in this thank you [Music] [Music] [Applause]
Info
Channel: AJ AUTOMATION
Views: 13,681
Rating: undefined out of 5
Keywords: push project to github, share project on github, push project from intellij to github, intellij to github share project, git push from IntelliJ, unable to push to github from Intellij, push code from intellij to git, git push, push maven, push maven project to github, learn github, push maven from intellij to github, push project to github repository
Id: JnFYQpzxj7U
Channel Id: undefined
Length: 14min 5sec (845 seconds)
Published: Fri Mar 24 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.