-- Leo's gemini proxy

-- Connecting to nuacht.flounder.online:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; charset=utf-8

git


git clone <url>

Copy a git repository to local machine


git clone --branch <branchname> <remote-repo-url>

Clone a branch instead


git add <filename>

Choose files to be uploaded / commited


git add -A

Instead of choosing, just include all changes automatically, please


git commit -m "<message>"

Add note to the commit


git push

Send / commit the files to the repository


git branch -a

List all git branches


git diff HEAD@{1}

Where n=1, diff existing code with previous commit. If n=2, compare with two commits ago.


undo a git add

git reset <file> or <directory>


Initial Setup

Instructions: https://docs.gitlab.com/ee/user/ssh.html


Client side:

1. ssh-keygen -t ed25519 -C "private key for gitlab"

2. (set a filename)

3. upload contents of .pub key to https://gitlab.com/-/profile/keys

4. add an entry to ~/.ssh/config with the following:

Host gitlab.com
  Hostname altssh.gitlab.com
  User git
  Port 443
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/gitlab.ophe.oh
  #(assuming gitlab.ophe.oh is the name set in step 2)

5. Run this command to test: ssh -T git@gitlab.com


errors

git@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Running these two commands fixes this for me:

eval `ssh-agent -s`
ssh-add ~/.ssh/gitlab_id_rsa

But, this was required every time after login so what actually fixed it permanently was to apt install keychain, and then append this to .bashrc:

eval $(keychain -q)

SSH key expiry

For this I generated a new key:

ssh-keygen -t rsa -b 4096 -C "<identifier or email-address>"

I added the public key contents to gitlab settings->SSH keys.

Then tested with ssh -T git@gitlab.com.


The next step was necessary but possibly only because of a previous error:

git remote remove origin
git remote add origin git@gitlab.com:<project>/repo.git

-- Response ended

-- Page fetched on Wed May 22 00:53:42 2024