Exercise4:
[Link]
lex_auth_01281262696086732810122_shared/overview
Modulename:ImplementationofCICDwithJavaandopensourcestack
ConfigurethewebapplicationandVersioncontrolusingGitusingGitcommandsandversion control
operations.
Answer:
GitInstallationonWindows
Letusnowlook atthevariousstepsintheGitinstallationon Windows.
Step1:
DownloadthelatestversionofGitandchoosethe64/[Link]
downloaded,[Link],selectLaunchtheGitBash,thenclickon finish. The
Git Bash is now launched.
Step2:
ChecktheGitversion:
$git--version
Step3:
Foranyhelp,usethefollowing command:
$githelp config
This command will lead you to a browser of config commands. Basically, the help the
commandprovidesamanualfromthehelppageforthecommandjustfollowingit(here,it's config).
Anotherwaytousethesamecommandisasfollows:
$gitconfig--help
Step4:
Createalocaldirectoryusingthefollowing command:
$mkdirtest
$ cdtest
Step5:
Thenextstepistoinitializethedirectory:
$gitinit
Step6:
Gotothefolderwhere"test"iscreatedandcreateatextdocumentnamed"demo."Open "demo"
and put any content, like "Hello Simplilearn." Save and close the file.
Step7:
EntertheGitbashinterfaceandtypeinthefollowingcommandtocheckthestatus:
$git status
Step8:
Addthe"demo"tothecurrentdirectoryusingthefollowing command:
$ gitadd [Link]
Step9:
Next,makeacommitusingthefollowingcommand:
$gitcommit-m"committing atextfile"
Step10:
Link theGitto aGithubAccount:
$[Link]
Note:simplilearn-githubistheusernameontheGithubaccount. Step
11:
OpenyourGithubaccountandcreateanewrepositorywiththename"test_demo"andclickon "Create
repository." This is the remote repository. Next, copy the link of "test_demo."
Step12:
GobacktoGitbashandlinktheremoteandlocalrepositoryusingthefollowingcommand:
$gitremoteaddorigin<link>
Here,<link>isthelinkcopiedinthepreviousstep. Step 13:
Pushthelocalfileontotheremoterepositoryusingthefollowing command:
$gitpushorigin master
Step14:
MovebacktoGithubandclickon"test_demo"andcheckifthelocalfile"[Link]"ispushed to this
repository.
AdditionalCustomizationOptions
1. Thisoptionenablesuserstoaddextraelementssuchassymboliclinksforcommandlines.
Nevertheless, one should always prefer default options for shortcuts or more.
2. TherearesomeexperimentaloptionsavailablesuchaspseudocontrolSupportorBuiltinfile system
monitor concerning your installed Git version.
HowtoLaunchGitin Windows?
[Link] shell with
the help of the command line and another is launching git using a graphical user interface.
1. Tolaunchgitviabashscripting shell,
First,openthewindowandsearchforgitbashandopenit.
2. Tolaunchgitviagraphicaluserinterface(GUI),similarly,firstopenthewindowandsearch for git
GUI and click on the application icon and open it.
ConfigureGitHubCredentials
You can configure your local GitHub installation with credentials by using the following
[Link],don'tforgettoaddyourownGitHubcredentialsforusernameandemail address.
1. gitconfig–globaluser.n
ame "github_username"
2. gitconfig–globaluser.e
mail "email_address"
CloneaGitHub Repository
1. InitiallyyouneedtoclicktheoptionsrepositoryonGitHub.
2. Theninthetoprightcorner,clicktheoptioncloneordownloadwhereasmalldrop-down box will
appear having a URL for cloning over HTTPS.
3. ThenenterintoyourPowershellwindowsandwritecloneURLas: git
clone repository_url
4. On theother hand, you can clone a github repository with SSH URLs where first you need to
generateanSSHkeypaironyourwindowsworkstationaswellasneedtoassignapublickey to your
GitHub account.
ListRemoteRepositories
1. MakeacopyoftherepositoryfromGitHubforyourworkingdirectory.
2. Ensurethattheworkingdirectoryshouldhavetheprojectnameas
"cdgit_project"andreplacetheprojectnamefromthedownloadedrepository.
3. Iftheaboveoptiondoesn'twork,you can listthecontentusing "lscommand"forthecurrent
directory, especially to check your exact number of spellings.
4. Besides,youcanlisttheremoterepositoryinthesub-directoryas"gitremote-v".
Summary:StepsForGitInstallationonWindows10
1. Downloadandinstall Git
2. Gitbash interface
3. BasicGitcommands
4. Createalocalrepository
5. Connecttotheremoterepository
6. PushthefiletoGitHub
[Link]
GototheGitForWindowswebsiteandclickonthe[Download]buttontodownloadandsave the
installer. Once downloaded double-click on the .exe file to begin installation.
[Link] Information
ToaccepttheLicenseAgreementclick[Next>]
[Link]
Irecommendselectingadirectorypathwithnospacesinthename,asintheillustrationbelow
[Link]
Selectthefollowingcomponentsandfileassociations,thenclick[Next>]
[Link] Folder
Acceptthesuggestednameand click [Next>]
[Link]
Thiswilldeterminewhich texteditorwillopen toinputcommitnotesandothertextmessages interactively.
Go for Nano if you are not familiar with more powerful editors like Vim
[Link] Name
LetGitdecideandclick[Next>]
[Link]
Makesureyouselect“UseGitfromGitBash only”
[Link] transport
[Link] reason to do
otherwise
[Link]
Makesureyouselect“CheckoutWindows-style,commitUnix-stylelineendings”
[Link]
SelectDefault
[Link] p
Gowiththerecommendedchoice
[Link]
Leaveuncheckedandclick[Next>]
[Link]
Leaveuncheckedandclick[Next>]
[Link]
Installationbegins…
[Link]
Clickon[Finish].Congratulations…jobdone!