Fourth Area of Git
- The fourth area of git is Remote Repository
- Remote Repository is a Git with some server features (Connectiviy, User managment)
- Remote Repository can be
- Self hosted (Where we install on one of our servers)
- Gitolite
- Gitlab
- BitBucket
- Cloud Hosted (Where the git with server featuers is preinstalled and you just need to configure users, repositories etc)
- GitHub
- GitLab
- BitBucket
- Azure Source Repos
- AWS Code Commit
- Self hosted (Where we install on one of our servers)
Scenario – 1
- You have started working locally and created some commits
- Now you want this code to be shared with your team members
- We create a Remote Repository & then push the changes from your local repo to remote Repo
- Local Repository with two changes
GitHub
- Create a GitHub Account
- Lets use SSH authentication
- Lets create SSH key pair in your system
- Press Enter for the next inputs which ssh-keygen asks
- In your home directory
(c:\users\<username> in windows /Users/<username> in mac and /home/<username> in linux)a .ssh folder will be created with two files- id_rsa => private key => to keep secure locally
- id_rsa.pub => public key => Git remote repository
- Lets add this ssh key to the GitHub
- Navigate to settings for user and do the below steps
- Now add the ssh public key contents
- Our authentication is ssh-based, Get the remote url from Git Hub
- Remote repository connection can be added to your local repository
git remote add <name-of-remote> <remote-url> - The default remote name used is
origin - Now my command would be
git remote add origin git@github.com:GitPracticeRepo/qt_hospital_app.git
- Now we need to push the changes
git push <remote-name> <branch-name>is the command to push
- We have pushed the changes to Github Refer Here and Gitlab Refer Here
