How to setup SSH keys in Github and Set up Java Web App using Maven in Github
We will see how to setup Java Web App using Maven in github and also how to setup SSH keys in github.
Implementation steps:1. after login into GITHUB, click on + and Click on Create Repository
3. Click on create repository.
4. In the upper-right corner of your github page, click your profile photo, then click Settings.
In the "Access" section of the sidebar, click SSH and GPG keys.
Click New SSH key or Add SSH key.
In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air".
Paste your key into the "Key" field.
Click Add SSH key.
If prompted, confirm your GitHub password.
5. now go to your laptop, open git bash for windows laptop
6. Now type ssh-keygen (and then simply press enter four times, do not give any password)
7. copy the content of public key executing below command in Gitbash.
cat ~/.ssh/id_rsa.pub
8. go to click on Add key from step # 3, and paste the content of public key. give some name as mySSH key. click on Add key.
9. Now click on repo you created in step # 1. Click on code and copy the SSH url. Do not select HTTPS Url. The url will be from your repo you created under Clone link.
git clone <ssh_url_from_github_repo_you_created>
11. Now after cloning, type ls -al command
12. It will show a folder with repo name..13. navigate to repo folder by below command:
cd mygithubrepo14. use below command to create Java project using Maven. Maven is the build for creating and building java projects.mvn archetype:generate -DgroupId=com.mkyong -DartifactId=MyWebApp -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false 15. type ls -al to see the new folder called MyWebApp
16. type below command to see the newly created project
git status
17. git add *
18. Perform below command to commit the changes to local repository first.
19. run this command to set yourself up as a first time user
git config --global user.name "John Doe"
git config --global user.email "johndoe@example.com"
replace the username with your github username and also the email with your email too
*** Then run this command to commit your project
git commit -m "my first project check-in to github"
git commit -m "my first project check-in to github"
20. Now perform below command to push from local repository to remote repository.
No comments:
Post a Comment