- Create a directory:
mkdir <folder-name>
- Go inside the directory:
cd <folder-name>
- You can create a README file:
touch README.md
- Initializes that directory as a Git repository by creating a .git subdirectory that contains all the necessary Git metadata for the repository:
git init
- Staging all changes in the current directory for the next commit:
git add .
- Commit with a message:
git commit -m "your message"
- In your Github account, create a new empty repository and copy the URL.
- Add the Github repository URL as a remote repository to your local repository(your directory):
git remote add origin <URL>
- Connect to Github using SSH:
- Generate SSH key:
ssh-keygen -t ed25519 -C "<your_email@example>.com"
- Show and Copy SSH key:
cat ~/.ssh/id_ed25519.pub
- Put SSH key in your Github account:
- Settings -> SSH keys and GPG keys -> New SSH keys
- Change the remote URL for your local repository, to git@github.com:
(Make sure you have the necessary SSH key set up on GitHub to authenticate with this new URL)
git remote set-url origin git@github.com:<username>/<repository>.git
- Verify the change:
git remote -v
- Push commited changes to Github:
(If remote-branch-name already exist, choose a different one)
git push -u origin <remote-branch-name>
Author: LuciaHeredia