The scenario: you created an empty project in gitlab, and initialized it with a readme.md file.
You also created a project on your PC and now want to hook up this project to your gitlab repository.
The problem: you have trouble because there’s already a readme.md file in gitlab in the empty project.
# on your PC remove the readme.md file that you may have locally,
# because it'll clash with the one from gitlab:
rm README.md
# run this once, if you're in windows, to use win cred:
git config --global credential.helper wincred
# use main instead of master
git config --global init.defaultBranch main
# initialize
git init
# switch from the default master to main, because gitlab renamed all master to main now
git checkout -b main
# specify the origin url in gitlab, pointing to your project
git remote add origin https://gitlab.com/..........your..........project.git
# do a pull
git pull origin main
# you should now see the readme.md file from gitlab in your local directory.
# next, add your files
git add .
git commit -m "new"
git push --set-upstream origin main
# go to gitlab and look for the files, they should all be there.