Navigate to the desired folder where you want to start a new git project, using cd
.
git init
Go to github.com, find your repository and click in the clone icon.
git clone {url}
SSH keys are usuful to login to a git remote server without having to type you password.
You'll have to create a key and upload the public key to the server (github.com, gitlab.com, bitbucket.com, etc)
[email protected]
ssh-keygen -t ed25519 -C "$EMAIL" -f "$HOME/.ssh/$EMAIL"
cat "$HOME/.ssh/$EMAIL.pub"
Copy the output of the command and .pub
file and then go to the website of your git provider, then to your account's settings and search for Add SSH Key.
git add {file}
or add everything
git add --all
git status # check the file to be commited
git add {file1} {file2}
git commit -m "write a descriptive message"
git switch -c {branch_name}
Attention: use this when you want to create (-c
) a new branch and work on it, if the branch already exist and you want to continue your work there, check the next one.
git switch {branch_name}
git remote add origin {remote_url}
git remote -v
git pull {remote_name} {branch}
Example:
git pull origin main
This is usually done after create a commit
git push {remote_name} {branch}
Example:
git push origin main