How to use GitHub under the Linux command line
This article mainly explains "how to use GitHub under the Linux command line". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use GitHub under the Linux command line.
1. Sign up for github account
two。 Create a ssh key
Cd ~
Ssh-keygen-t rsa-C your_email@example.com
The id_rsa.pub file is generated under ~ / .ssh /, and SSH and GPG keys-on the github website
> New SSH Keys, write the title casually, you can write the name of the computer, and change the contents of the id_rsa.pub
Paste in key, and finally click Add SSH Key.
3. Open the terminal
Ssh-T git@github.com
If you prompt Permission denied (publickey) for this step, execute ssh-keygen-t rsa
-b 4096-C "your_email@example.com" to regenerate key, a prompt appears indicating that the positive
Often connect to github
Hi ganchunsheng! You've successfully authenticated, but GitHub does
Not provide shell access.
4. Create a warehouse on github
Upload the code as follows:
Git init # initialization
Git add. # initialize the local warehouse
Git commit-m "first commit" # annotated and submitted to the local warehouse
Git remote add origin https://github.com/xxxx/test.git # connects to the remote warehouse
Git push-u origin master # submits things from the local warehouse to the master branch
5. Download the code
Master Branch:
Git clone https://github.com/xxxx/test.git # xxxx is the user name
Include subbranches:
Git clone-- recursive https://github.com/xxxx/test.git
6. common problem
(1) error prompt: fatal: remote origin already exists. Solution:
Git remote rm origin
(2) git is not initialized
* Please tell me who you are.
Run
Git config-global user.email "you@example.com"
Git config-global user.name "Your Name"
Solution:
Git config-global user.name "your_email"
Config-global user.email your_email@example.com
At this point, I believe you have a deeper understanding of "how to use GitHub under the Linux command line". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!