background
GitHub does not support rest. It operates the warehouse,
(i.e. account + password, operation, no more)
The warehouse operation of GitHub supports the operation based on token authentication
( token-based authentication )
This article describes how to operate git repo on GitHub through SSH
details
GitHub supports SSH deployment with comprehensive granularity,
- All warehouses can be deployed uniformly based on users
- Can be deployed based on warehouse
So one user creates multiple organizations,
There is only one user in each organization,
How to deploy uniformly?
The author has not made any research yet. This paper then describes the deployment of SSH sub warehouse
The solution is to use the local SSH configuration file
~/.ssh/config
Modify profile
Generally, our configuration file looks like this
Host * // General
Addkeystoagent yes // add a key
Usekeychain yes // use persistence
IdentityFile ~/. ssh/id_ Ed25519 // the file path is named by the default encryption method
Now a repo corresponds to a host
Added, two configurations
Host github1 // host
HostName github. COM // server name
User git // user
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/. ssh/id_ A // a warehouse and a private key
Host github2
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_repo2
Modify the remote path remote URL of the local git repository
The result is
git remote -v
origin github1:AgesX/_off_screen_render.git (fetch)
Paste the corresponding public key into GitHub repo
Remember to check to allow writing
The above are the main links of the process
Enter the number of words below
CD a folder, inconvenient
After a few years of development, old eyes are dim,
Cannot accurately drag a specified folder
I developed,cdc
Enter the folder,cdc
Drag and drop a sub file to the terminal at will
It’s equal to finding the folder you want accurately
cd_current(){
cd "$(dirname "$1")" && pwd
}
alias 'cdc'='cd_current'
View git repository, file based log
Can considergitlf
git log file
gitlf_file(){
git log --follow -p -- "$1"
}
alias gitlf="gitlf_file"
- Create key
ssh-keygen -t ed25519 -C "[email protected]"
- Submit
git remote set-url origin Mm:AgesX/gcd_
Generate a new SSH key and add it to SSH agent
Command:
ssh-add -K ~/.ssh/id_a
All the private keys have to come again