Assume that you have a project and you want to track it with Github.
Navigate to the project folder, and initialize git by running
git init .
Create a .gitignore file to specify files that you want to ignore when pushing all your files to remote repo (i.e., specify files you don’t want to track)
Then add all relevant files of the project and do commit
git add . git commit -m"A message for the commit"
Say you’ve already set up a brand new repo on Github dedicated to the project.
Now let’s connect our local repo to that remote Github repo:
git remote add origin https://firstname.lastname@example.org/username/reponame git pull origin main --allow-unrelated-histories
Now push your project to the remote repository by running the following command
git push origin main