💾 Archived View for darknesscode.xyz › notes › git.gmi captured on 2023-07-22 at 16:23:28. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-05)
-=-=-=-=-=-=-
This are the most used git commands (this example i used github, it should work with another services)
Check git status:
git status
Add files to repo:
git add .
Add a commit to the new files, fixes, updates to repo:
git commit -m "Your commit"
Push/Upload repo from local machine to the remote server:
git push -u origin master
Pull/Download/Update you repo to local machine:
git pull orign master
Add you user name and you email to git. This is important because git commits uses this information
git config --global user.name "username"
git config --global user.email "user@email.com"
First create the ssh keys in your local computer. [here how to](https://darknesscode.com/notes/ssh-keygen/). Then copy the public key into the git service.
If you download your own repo over https or ssh you can switch it to what ever you want to use, i prefer to use ssh in my local machine.
Switch a git from https to ssh run this command:
git remote set-url git@github.com:username/repo.git
Where username, your username for your git (hub or labs). Repo.git is the name or you repository.
Switch a git from ssh to https run this command:
git remote set-url https://github.com/username/repo.git
Where username, your username for your git (hub or labs). Repo.git is the name or you repository.
----------
----------
© DarknessCode