Lecture # 9 - Connecting local and remote repositories
Connecting the local repository with the remote repository and pushing files.
Follow the steps to connect local repository with the remote repository and pushing files:
Initialize a local repository. This is done using
git init
command. Click Here to learn how to setup a git repository locally.-
Create a repository remotely. If you don't know how to to create remote repository then Click Here fir GitLab, Click Here for GitHub, and Click Here for Bitbucket. I made a repository on GitHub.
-
Now add a reference to the remote repository. This is done by
git remote add origin [repository-url]
. -
Now verify that the remote repository has been added correctly or not by using
git remote -v
command. -
Now add the files/folders that you want to send to the remote repository to the staging area using the
git add
command.git add .
will stage all the files present in the directory. -
See the files/folders present at the staging area using
git status
command. -
Commit the files/folders to the local repository using
git commit -m "your commit message"
. -
List the commits using the
git log
command. -
Now push the committed changes to the remote repository using
git push -f origin [branch-name]
. -
Let's see our remote repository.
This is how we connect local repository with the remote repository and send files from the local repository to the remote repository.