Go to GitLab or GitHub and create a new project.

Type

git init

to initialize a new local Git repository.

  • git add: your files to the local repository with git add .
  • Commit the changes with git commit -m “Commit message”

link the local repository with the remote one:

git remote add origin <remote-repository-URL>

Replace with the URL of your GitLab repository.

You can see that it is configured correctly:

git remote -v

If you choose ssh, you must add your ssh-keys to the remote repository.

Type

 git push -u origin main

to push your changes to the remote repository