1, $ cd ~/.ssh or CD. SSH
If not, prompt: No such file or directory
If you are not prompted: No such file or directory indicates that you are not using Git for the first time, do the following to clean up the original SSH key
Config Id_rsa id_rsa.pub known_hosts
$ mkdir Key_backup
$ CP id_rsa* Key_backup
$ RM id_rsa*
2. Use Git bash to generate a new SSH key.
$ cd ~ #保证当前路径在 "~" under
$ ssh-keygen-t rsa-c "[email protected]" #建议填写自己真实有效的邮箱地址 (fill in the email address, and then always "enter" on it, you can also enter the password as prompted below)
Generating public/private RSA key pair.
Enter file in which to save the key (/C/USERS/XXXX_000/.SSH/ID_RSA): #不填直接回车
Enter passphrase (empty for no passphrase): #输入密码 (can be blank)
Enter same Passphrase again: #再次确认密码 (can be empty)
Your identification has been saved In/c/users/xxxx_000/.ssh/id_rsa. #生成的密钥
Your public key has been saved in/c/users/xxxx_000/.ssh/id_rsa.pub. #生成的公钥
The key fingerprint is:
e3:51:33:xx:xx:xx:xx:xxx:61:28:83:e2:81 [email protected]
Open Local: \.ssh\id_rsa.pub file. The contents of this file are just the generated human key.
3. Login to GitHub system. In the top right corner, click Account Settings--->ssh public keys---> add another public keys to copy your locally generated key into the inside (Key text box), click on Add key to OK
4. Then open git to test if the connection is successful
$ ssh-t [email protected]
If prompted: Hi defnngj you ' ve successfully authenticated, but GitHub does not provide shell access. It means you're connected.
5. Set User information:
$ git config--global user.name "defnngj"//Give yourself a username
$ git config--global user.email "[email protected]"//fill in your own mailbox
6. Submit to GitHub
$ mkdir Test $ cd Test $ git init #将test初始化为git仓库 $ touch README $ git add README $ git commit-m ' first commit ' #通 "Git commit-m" to commit the update. -M followed by a description of the commit (message)
# submit
$ git Remote add origin [email protected]:youusername/test.git
$ Git push-u Origin Master
Some git operations (figure to Freesaber http://www.cnblogs.com/zhongxinWang/p/4205339.html)
Local git repository submitted to GitHub