background

Github does not support the rest form of operation repository,

(Account + password, action, no more)

The github repository supports token-based authentication

(token – -based authentication)

SSH git repo on Github

details

GitHub supports comprehensive SSH deployment granularity,

  • All warehouses can be deployed uniformly, based on the user

  • Can be deployed based on a repository

So one user creates multiple organizations,

Each organization, and only that user,

How to unify the deployment?

The author has not yet studied successful, this paper then describes the SSH warehouse deployment

The solution is to use the local SSH configuration file

~/.ssh/config

Modifying a Configuration File

Normally our configuration file looks like this

UseKeychain yes UseKeychain yes use persistent IdentityFile ~/.ssh/id_ed25519 // File path, named with default encryption modeCopy the code

Now one REPO corresponds to one host

Two configurations have been added

Host github1 // Host HostName github.com // Server name User git // User AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_a // One private key Host github2 HostName github.com User git AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_repo2Copy the code

Example Change the remote url of the local Git repository

The results for

git remote -v                 
Copy the code

origin github1:AgesX/_off_screen_render.git (fetch)

Paste the corresponding public key into the Github repo

Remember to check to allow write

This is the main part of the process

Let’s go into the word count

CD a folder, inconvenient

After a few years of development, my eyes grew dim,

Unable to drag a specified folder accurately

I developed,cdc

Enter the folder, CDC and drag a subfile to the terminal at will

It’s the same as being accurate, finding the folder you want

cd_current(){
  cd "$(dirname "$1")" && pwd
}


alias 'cdc'='cd_current'

Copy the code

View git repository, file-based logs

Consider gITLF

git log file


gitlf_file(){
   git log --follow -p -- "$1"
}
alias gitlf="gitlf_file"
Copy the code