Been working with Git for a few years now and I have to say memory isnt my strong suit. I have these commands noted and refer to them often. Here are the commands that get me up and "sycning" to my get repos.
Intiailze the repo locally
Add all files in current and subdirectories to git
git add -A
Create initial commit with init as the message
git commit -m "init"
git commit -m "INSERT YOUR MESSAGE HERE"
Add your remote repo for backup, you can find this from your remote repo provider. A few options: github.com bitbucket.com gitlab.com
git remote add origin https://firstname.lastname@example.org/userid/repo_name.git
Now that we have our repo iniilzaized, added all our files, committed them and added the remote repo, its time to push our local git to the remote master. This may prompt for a username/password, this you should have setup with your repo provider
git push origin master
If you have any questions please let me know. Hop this helps someone.
Error I received at one point or another:
email@example.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
❯ ssh-add -l
The agent has no identities.
❯ ssh-add ~/.ssh/YOURKEY.pem
Identity added: /Users/userid/.ssh/YOURKEY.pem (/Users/userid/.ssh/YOURKEY.pem)
❯ git push --set-upstream origin master
When fetching master branch, the files do not reflect the master state:
git fetch origin
reset your local to master
git reset --hard origin/master