$ ssh-keygen -t rsa -C "youremail@gmail.com" Generating public/private rsa key pair. Enter file inwhich to save the key (/home/user/.ssh/id_rsa): #保存位置,回车 Enter passphrase (empty For no passphrase): #加密,不加密直接回车 Enter same passphrase again: #加密校验 Your identification has been saved in /home/user/.ssh/id_rsa. Your public key has been saved in /home/user/.ssh/id_rsa.pub. ......
如果备份了 id_rsa 和 id_rsa.pub 文件,可以直接将其复制到 ~/.ssh 目录:
1
$ cp ./id_rsa* ~/.ssh
复制后要检查密钥文件的读写权限,安全的设置如下:
1 2 3
$ ls -al ~/.ssh/id_rsa* -rw------- 1 user grp 1675 Aug 11 02:23 /home/user/.ssh/id_rsa -rw-r--r-- 1 user grp 401 Aug 11 02:23 /home/user/.ssh/id_rsa.pub
$ cd project # 拉取远程或其它仓库内容合并到本地仓库 # Fetch from and integrate with another repository or a local branch $ git pull # 将文件内容添加到索引中 # Add file contents to the index $ git add --all $ git add . $ git add <file>... # 提交修改到本地仓库 # Record changes to the repository $ git commit -a -m "说明" # 将本地暂存内容更新到远程仓库 # Update remote refs along with associated objects $ git push