💾 Archived View for darknesscode.xyz › notes › git.gmi captured on 2022-06-03 at 22:45:40. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-05)

-=-=-=-=-=-=-

Git Commands

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

Set Global Identity

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"

SSH

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.

Set Git Remote

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 form https to ssh

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 form ssh to https

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.

----------

Home

Linux

Notes

MicroLog

----------

© DarknessCode