Skip to content

Sync a Repository

Overview

Update your local repository and send your changes to the remote repository.


Before you begin

Make sure:

  • you have cloned the repository
    (see: Clone a repository)
  • you are inside the repository directory
  • you have permission to update the repository

Steps

1. Open a terminal

Open a terminal on your local machine.


2. Navigate to the repository

cd <repository-name>

3. Check repository status

git status

4. Get latest changes

git pull

5. Add your changes

git add <file-or-directory>

To add all changes:

git add .

6. Commit your changes

git commit -m "<commit-message>"

Replace <commit-message> with a short description of your change.


7. Send changes to the repository

git push

Verify

Check that:

  • your changes are committed:
git status
  • your branch is up to date:
git log -n 3

Troubleshooting

Nothing to commit

Possible causes:

  • no changes were made
  • changes were not added

Check:

git status

Push rejected

Possible causes:

  • remote repository has new changes
  • you need to pull before pushing

Run:

git pull

then retry:

git push

Authentication failed

Possible causes:

  • incorrect credentials
  • authentication method not configured