If you need to move a repo from one to another, use the following code
cd existing_repo
git remote rename origin old-origin
git remote add origin [email protected]:path/to/project/projectname.git
git push --set-upstream origin --all
git push --set-upstream origin --tags
To push to an existing folder
cd existing_folder
git init --initial-branch=main
git remote add origin [email protected]:path/to/project/projectname.git
git add .
git commit -m "initial commit"
git push --set-upstream origin main
To create a new repository
git clone git:gitsite.com:path/to/project/projectname.git
cd projectname
git switch --create main
touch README.md
git add README.md
git commit -m "add README"
git push --set-upstream origin main
Setting the git global setup
git config --global user.name "your name"
git config --global user.email "[email protected]"
Job done!