DevOps Classroomnotes 15/Jul/2023

Fourth area of Git – Remote Repo

  • Remote-Repo: This represents git repository some where else
    Preview
  • Any software which hosts git-repo is called as git servers or git hosted repositories
  • Git Remote Repositories can be hosted by many platforms/servers
    • Self-Hosted:
      • Gitolite
      • Git-lab
    • Cloud-Hosted or Git as Service
      • GitHub
      • BitBucket
      • Azure Source Repos
      • AWS Code Commit
  • Git repository will have connection to remote-repo and a name to it. Default remote conections name is origin
  • Cases
    • if you have local repo and then if you have created remote repo
      • remote add to add connection
      • push to send your git objects
      • pull to get git objects
    • you have remote repo already and you need local repo in your system.
      • clone
  • When a remote repo is connected git branch -r will show remote branches
  • Git pull has two variants
    • pull: this might lead to extra merge commits
    • pull with rebase: this will not lead to extra merge commits
  • Pull operation is fetch + merge
  • pull or push command require name of remote and branch names
git pull origin main
git push origin main
  • if you want to set default remote and branch then we can set upstream branch
# while first creation of branch and pushing

git push  -u origin main

Activity

  • Create a new repository in
    • Github: Refer Here
    • Azure Source Repos
    • AWS Code Commit

Tags

  • Git reference objects refspec
    • Branches
    • Tags
  • Tag points to specific commit and it doesn’t move like branch
  • We have two types of tags
    • lightweight tags
    • annonated tags

Exercise

  • Create a new repo
  • make 3 commits
  • delete 2nd commit
  • now recover the deleted commit

Install – Jenkins

sudo apt update 
sudo apt install openjdk-17-jdk -y
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt update
sudo apt install jenkins -y

  • Navigate to http://<public-ip>:8080
    Preview
  • findout the initial Admin password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Preview
* Now install suggested plugins
Preview
Preview
* Create a new admin user
Preview
Preview
Preview
Preview
*

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner