Git
GitHub​
Set SSH Key in Github Account​
- Set Up SSH Key, and copy you
.pub
file - Get into your
Github Profile Settings
>SSH and GPG keys
>New SSH key
. - Paste the content of your
.pub
file to thekey
section, and give title whatever you want - Check it by running this command in your local terminal.
ssh -T [email protected]
- If it success, it will show this message
Hi GungIndi! You've successfully authenticated, but GitHub does not provide shell access.
Connect Local Repo to Remote Repo GitHub​
# Initialize git
git init
# Add remote repo and check
git remote add origin [REMOTE_URL]
git remote -v
# Renames if needed
git branch -M main
# Pull and Rebase (if there's README file)
git pull origin main --rebase
# Set url if want to use SSH (OPTIONAL)
git remote set-url origin [REMOTE_SSH_URL]
# Usual command when wanna push
git add .
git commit -m [comment]
git push origin main
Gitlab​
Set SSH Key in G Account​
- Set Up SSH Key, and copy you
.pub
file - Get into your
Edit Profile
>SSH keys
>Add new key
. - Paste the content of your
.pub
file to thekey
section, and give title and expiration date whatever you want - Check it by running this command in your local terminal.
ssh -T [email protected]
- If it success, it will show this message
Welcome to GitLab, @putra.2205551079!
Connect Local Repo to Remote Repo GitLab​
git init --initial-branch=main
git remote add origin [email protected]:gungindi/build-it.git
git add .
git commit -m "Initial commit"
git push --set-upstream origin main