Apr 04, 2017 $ gpg -output to-bob.gpg -export BAC361F1 $ gpg -armor -export BAC361F1 mypubkey.gpg The output will be redirected to mypubkey.gpg file which has the content of the public key to provide for communication. To generate your key pair, we'll work from the command line. Open a terminal window and issue the following command: gpg -gen-key. This fires up the process, and you'll be asked a number of. I have generated keys using GPG, by executing the following command gpg -gen-key Now I need to export the key pair to a file; i.e., private and public keys to private.pgp and public.pgp, respect.
Let MAC connect with its GitHub website locally (SSH)
Gpg -expert -full-generate-key. When prompted for what kind of key, pick option: (8) RSA (set your own capabilities). Next you want to toggle off the sign and encrypt capabilities from the key. When prompted for capabilities, type s and hit enter to toggle off the Sign capability. May 28, 2015 How to generate PGP keys using GPG 1.4.5 on Linux. Terence Munday Application Architect. This blog describes how to generate a private/public key pair using GPG version 1.4.5. The resulting public key will contain two keys, one key for signing and a subkey for encryption. The command '-edit-key' to generate a subkey for this. Command options that can be used in combination with other command options. To produce a ciphertext file in ASCII format, just add the -a option when encrypting or signing a message or extracting a key: gpg -sea textfile. To specify a recipient, add the -r option followed by a user id: gpg -se -r recipient textfile.
Download and install git website: https://git-scm.com/downloads
Check whether the installation is successful: git – version
$ git version
git version 2.15.1 (Apple Git-101)
chengyuandeMBP:.ssh chengyuan$
Create SSH key: check whether there is SSH
$ cd ~/.ssh
$ ls
id_rsa id_rsa.pub known_hosts
It is recommended to recreate SSH whether there is one or not
Create SSH
$ ssh-keygen -t rsa -C [email protected] // 1. Email account of [email protected] when you sign up for GitHub
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/dpc/.ssh/id_rsa): // 2. . SSH default path, do not enter or modify
Enter passphrase (empty for no passphrase): // 3. The password length must be at least 4, otherwise it will fail
Enter same passphrase again:
Your identification has been saved in /Users/dpc/.ssh/id_rsa.
Your public key has been saved in /Users/dpc/.ssh/id_rsa.pub.
The key fingerprint is:
8d:d3:5f:31:ae:13:48:f0:78:df:a1:8f:a5:a4:c0:06 [email protected]
The key’s randomart image is:
+–[ RSA 2048]—-+
| . |
| + |
| E . + + |
| o * o + + |
| S + = = |
| . o + O |
| . * . |
| . |
| |
+—————–+
Enter file in which to save the key (/Users/dpc/.ssh/id_rsa): // 2. . SSH default path, do not enter or modify
Enter passphrase (empty for no passphrase): // 3. The password length must be at least 4, otherwise it will fail
Enter same passphrase again:
Your identification has been saved in /Users/dpc/.ssh/id_rsa.
Your public key has been saved in /Users/dpc/.ssh/id_rsa.pub.
The key fingerprint is:
8d:d3:5f:31:ae:13:48:f0:78:df:a1:8f:a5:a4:c0:06 [email protected]
The key’s randomart image is:
+–[ RSA 2048]—-+
| . |
| + |
| E . + + |
| o * o + + |
| S + = = |
| . o + O |
| . * . |
| . |
| |
+—————–+
Open GitHub and click your avatar settings A kind of : SSH and GPG keys on the left navigation bar A kind of ️ new SSH key
Go back to the command line $open ~ /. SSH
Open the id_rsa.pub file in the pop-up folder and copy the contents (you can also find it by yourself according to the path)
Paste the copied content into the key of new SSH key, add and save it, and fill in the email of my own GitHub when registering
Check whether the key configuration is effective SSH – t [email protected]
$ ssh -T [email protected]
Enter passphrase for key ‘/Users/dpc/.ssh/id_rsa’://Password just set****
Hi dopocheng! You’ve successfully authenticated, but GitHub does not provide shell access!!
Submission code
1. Initial submission agent
Enter the folder where you want to submit the code (important!!)
$git init / / initialize local warehouse
$git add XX. JSON / / add the code file to be submitted
$git commit – M “your comment…” / / submit to local repository
$git remote add origin [email protected]: XXXX / xxxx.git / / connect to the remote warehouse (i.e. GitHub)
$git push – U origin master / / first commit
$git add XX. JSON / / add the code file to be submitted
$git commit – M “your comment…” / / submit to local repository
$git remote add origin [email protected]: XXXX / xxxx.git / / connect to the remote warehouse (i.e. GitHub)
$git push – U origin master / / first commit
Note that git @ GitHub. Com: XXXX / XXXX. Git = = git @ GitHub. Com: dopocheng (a picture of a dot whose GitHub user name is not known) / alone part (the project name should be the same as the suggested project name). Git
2. Modify code or change local computer to submit
Git status view modified files
Changes not staged for commit:
(use “git add/rm …” to update what will be committed)
(use “git checkout — …” to discard changes in working directory)
deleted: “src/views/complex-component/346226260345273272346226207346234254346226207346241243 (2).txt”
modified: src/views/echarts/covid-19.vue
no changes added to commit (use “git add” and/or “git commit -a”)
Git add with modification and subject submission and git commit
$git add Src / views / echorts / covid-19.vue / / add the code file to be submitted
$git commit – M “new coronavirus statistics modification” / / submit to local warehouse
$ git push origin master
$git commit – M “new coronavirus statistics modification” / / submit to local warehouse
$ git push origin master
If git push fails
View the above key configuration SSH – t [email protected]
Not OK. Go to reconfigure the key
OK! Then check the remote warehouse details
$ git remote -v
origin[email protected]:dopocheng/alone-part.git (fetch)
origin[email protected]:dopocheng/alone-part.git (push)
Dopocheng must be your own GitHub user name. Alone part is the remote warehouse name corresponding to the first project you submit
GitHub view warehouse name
If not, add or modify the remote warehouse
$ git remote add origin [email protected]:dopocheng/alone-part.git
fatal: remote origin already exists.
Delete git remove origin first
Add git remote add origin [email protected]: dopocheng / alone-part.git (I use SSH and you can switch use HTTPS)
In this way, you can check the remote warehouse information again, and git push will be OK!!!
GNU gpg is encryption and signing tool.
The GNU Privacy Guard (GnuPG or GPG) is a free software replacement for the PGP suite of cryptographic software.
GnuPG encrypts messages using asymmetric keypairs individually generated by GnuPG users. The resulting public keys can be exchanged with other users in a variety of ways, such as Internet key servers. They must always be exchanged carefully to prevent identity spoofing by corrupting public key ↔ ‘owner’ identity correspondences. It is also possible to add a cryptographic digital signature to a message, so the message integrity and sender can be verified, if a particular correspondence relied upon has not been corrupted.
How do I create my own GnuPG private and public key
1) Login to your shell account
2) Use gpg command to create the keys
Output:
$ gpg --gen-key
Output:
3) Now keys generated, you can list your own key using:
OR
Output:
$ gpg -K
OR
$ gpg --list-keys
Output:
Let us try to understand the line pub 1024D/CA7A8402 2007-02-10:
- pub : Public key
- 1024D : The number of bits in the key
- CA7A8402 : The key ID
- 2007-02-10 : The date of key creation
- Vivek Gite : The user real name
- <[email protected]> : The email id
Most important is the key ID i.e. CA7A8402. Make sure you use powerful passphrase to protect keys and not the easy one.
4) To list secret key, type the command:
Output:
$ gpg --list-secret-keys
Output:
Mac Command Line Commands
ADVERTISEMENTS