-
Download and intall git: Available here
-
Create a new folder, right click on it and choose 'Git bash here'
-
Configure your user name and email
git config --global user.name username
git config --global user.email email
- Initialize git with
git init
- Testing commits
touch test.txt
git add .
git commit -m "First commit"
- Link the ssh key to your email
ssh-keygen -t rsa -C email
Press enter or choose in which folder you wish to save the ssh key and set (or not) a passphrase
-
Go to your github settings and then to SSH and GPG Keys. Click on New SSH Key, give it a title and pass the key you just created on the above step. It can be found using the
notepad ~/.ssh/id_rsa.pub
command on bash. -
Go back to git Bash and type
ssh -T git@github.com
- To clone a repository in your local machine, click on Code --> SSH and copy the link
- Then, git bash on tha folder you want to clone the repository to and type
git remote add origin git@github.com:user/repo_name.git
change user and repo_name!
- Update the folder in your computer
git push
- Commit and pull
git add .
git commit -m 'comment'
git pull origin branch_name
- Change branch
git checkout <existing_branch>
git checkout -b <new_branch> (if branch does not exist)
run git push -u origin master on terminal or
git remote rm origin
git remote add origin https://github.com/USERNAME/REPOSITORY.git
git init
gh repo create <repo name> --public --source=. --remote=upstream
git add .
git commit -m 'm'
git branch -M main
git remote add origin git@github.com:user/repo_name.git
git push origin main