Fourth area of Git – Remote Repo
- Remote-Repo: This represents git repository some where else
- Any software which hosts git-repo is called as
git servers
orgit 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
- Self-Hosted:
- 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 connectionpush
to send your git objectspull
to get git objects
- you have remote repo already and you need local repo in your system.
- clone
- if you have local repo and then if you have created remote repo
- 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
- Refer Here for installing jenkins on linux
- Ubuntu steps: Refer Here
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
- findout the initial Admin password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
* Now install suggested plugins
* Create a new admin user
*