Add an existing website folder to a repo

1. Reinitialize the Repository

cd /yoursite
git init
git remote add origin <REMOTE_REPO_URL>

2. Fetch and Reset to the Latest Commit

git fetch origin
git reset --hard origin/master

3. Test git pull

git pull origin master

4. Validate Global Git Configuration

git config --list --global

5. Review pull.ff=false and pull.rebase=true

  • You currently have pull.ff=false, which means Git will always create a merge commit even when a fast-forward is possible.
  • pull.rebase=true means Git will attempt to rebase your changes instead of merging them when pulling.

If you want the default Git behavior (fast-forward if possible, merge otherwise), reset them:

git config --global --unset pull.ff
git config --global pull.rebase false

6. Check credential.helper=store

  • This means Git is storing credentials in plaintext (~/.git-credentials). If you want a more secure approach, switch to:

git config –global credential.helper cache

Final Checks & Git Pull Test

git remote -v

If the remote is missing, add it back:

git remote add origin <REMOTE_REPO_URL>

Fetch and Pull the Latest Changes

git fetch origin
git pull origin main
git status

 Check Remote Repository

First, ensure that your local branch is correctly tracking the remote:

git branch -vv

If master isn’t tracking origin/master, set it manually:

git branch --set-upstream-to=origin/master master