Please work on setting up a Java project (using maven) in Github by following below steps. You need to complete lab exercise # 1 first before you do this one.
Please note I am sending this in advance but I will demo this when we meet in next time.
Pre-requistes:
If you don't have a github account, You need to create an account in http://github.com
Implementation steps:
1. after login into bitbucket, click on + and Click on Create Repository
In the upper-right corner of any 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.
4. now go to your laptop, open git bash for windows laptop or iTerm (for iMac laptop) and connect to Jenkins EC2 instance using Git bash. How to connect, refer this url - https://devopstraining2000.blogspot.com/2022/04/module-5-how-to-connect-to-ec2.html
5. Now type ssh-keygen (and then simply enter four times, do not give any password)
6. copy the content of public key executing below command in Gitbash.
sudo cat ~/.ssh/id_rsa.pub
7. 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.
8. Now click on repo you created in step # 1. Click on Clone and copy the SSH url. Do not select HTTPS Url. The url will be from your repo you created under Clone link.
9. go back to Gitbash windows connected to Jenkins EC2, execute the below command. Paste the SSH url you copied above.
git clone <ssh_url_from_github_repo_
you_created> using ssh option in the github
and enter yes when prompted
11. It will show a folder with repo name..
12. navigate to repo folder by below command:
cd DemoApp
13. 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-ar
chetype-webapp -DinteractiveMode=false 14. type ls -al to see the new folder called MyWebApp
git commit -m "my first project check-in to github"
19. Now perform below command to push from local repository to remote repository.
No comments:
Post a Comment