Centos: the error message "Permission denied publickey" is displayed during git clone. centospublickey
Initialized empty Git repository in/data1/mouxuan/fastsocket-private/. git/
Permission denied (publickey ).
Fatal: The remote end hung up unexpectedly
1. cd ~ /. Ssh
2. ssh-keygen-t rsa-C you@Email.com
Press enter when prompted
3. ssh-add id_rsa
If: cocould not open a connection to your authenticationagent appears.
Input: ssh-agent bash: Use ssh-add id_rsa
4. log on to github.com -- AccountSetting -- ssh and click Add.
Add the content in the id_rsa.pub File
Finally, git clone succeeded (with ssh)
Git clone with http failed
Can I send the command line and error message together.
Because the error message seems to be SSH.
How to upload code locally on github
After registering GitHub, you will have a free space of 0.3G, but you can only create public projects, which also meets the purpose of code sharing. My favorite is its code display method, you can directly browse your Code. The Code has been highlighted and processed by adding a row number. It is very beautiful and has a first-class experience, such as the Webpy hosted place. If you want to know your code, you can directly browse your desired code online, download the compressed package directly, or clone it to your local machine using Git.
Because GitHub is based on the Git version control system, you need to use the Git tool to upload and modify the code. I am here mainly to share and present code, so I don't want to elaborate too much on version control. I will briefly explain how to create a new project on GitHub, and upload your own code. The premise below is that you have registered GitHub and downloaded and installed Git-Git download and Windows Version Download.
Upload and share code
1. Create a project on GitHub
After logging on to GitHub, you can find a button "New Repository" in the middle of the right side. After clicking it, enter the project name, description, and URL to create it, then there will be a prompt page, write down like email@example.com: XXX/XXX. git address. This is the address of your project.
2. Configure Git and upload code
After successfully installing Git, if you select Git Bash in Windows, it may be a bit difficult to complete everything in the command line, but remember the few command lines. First, set Git:
1 git config -- global user. name "Your Real Name" 2 git config -- global user. email firstname.lastname@example.org
Then start the most troublesome step. You need to upload a file to GitHub's Git system, and you need an SSH key for authentication. Next we will start to generate the key and submit the key. Open Git Bash and create an SSH key:
1 ssh-keygen-C 'your @ email. address'-t rsa
Enter the location where the SSH key is stored. You can directly press enter to use the default path. Enter the password you want, And the SSH key is generated. Now you need to submit the Key to GitHub. First open the Key storage location, which contains three files, find id_rsa.pub, open it in a text editor, and copy all the characters in it. Go to GitHub and find Account Settings in the toolbar in the upper-right corner. On this page, there is an SSH Public Keys tag and select Add another public key. You can enter either Title or Key to paste the character and submit it.
After completing these tasks, you can upload your own code. Find the code folder you want to share and upload, right-click and select Git Bash, or enter the folder in Git Bash. Create a repository:
1 git init
Select the file to be added to the repository:
1 git add.
Generally, if you want to share all the code in this folder, add ". ", the above example is like this. If you specify the parameter, you only need to set". "change to the file name. Now, you only select the file to be added to the repository. The following shows how to add the file to the repository:
1 git commit-m'test'
-M is followed by a parameter, indicating that after the code is submitted to GitHub, the description, such as the marked place, will be displayed on the code file information.
After so long, I began to upload the local repository to GitHub. The following two commands solve the problem:
1 2 git remote add origin email@example.com: XXX/XXX. git 3 git push-u origin ...... the remaining full text>