Suppose you have a project and wish to start tracking it with Github, Bitbucket or AWS CodeCommit.
First you need to navigate to the project folder locally & run the following command to initialize the git.
git init .
One of the best practices when using git is to maintain project .gitignore file, in order to ignore files & folders when pushing files to the remote repo.
Then add all files & folders from current project and do commit by running the following command.
git add . git commit -m"A message for the commit"
Assuming that you have already repo in for example Github, let connect the local repo to the remote Github repo by running the folowing commands.
git remote add origin https://firstname.lastname@example.org/username/reponame git pull origin master --allow-unrelated-histories
Now it’s time to push project source to the remote repo by running the following command.
git push origin master
That is all you need to do, quite simple isn’t it 🙂