Lecture # 9 - Connecting local and remote repositories

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:

  1. Initialize a local repository. This is done using git init command. Click Here to learn how to setup a git repository locally.

  2. 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.

  3. Now add a reference to the remote repository. This is done by git remote add origin [repository-url] .

  4. Now verify that the remote repository has been added correctly or not by using git remote -v command.

  5. 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.

  6. See the files/folders present at the staging area using git status command.

  7. Commit the files/folders to the local repository using git commit -m "your commit message" .

  8. List the commits using the git log command.

  9. Now push the committed changes to the remote repository using git push -f origin [branch-name] .

  10. 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.