1.下载git在windows机器安装;
2.打开gitbash:
$ cd /e/MyGithub
$ mkdir GitTest
$ cd GitTest
$ git init
Initialized empty Git repository in e:/MyGitHub/GitTest/.git/ //表示初始化一个本地代码库成功
$ touch readme.txt //添加一个文件
$ git add readme.txt //将文件添加到版本控制中
$ git commit -m "first commit" //第一次提交
[master (root-commit) 06899d3] first commit
1 file changed, 1 insertion(+)
create mode 100644 readme.txt
3.现在想把该文件同步到我的github.com上:
$ ssh -vT git@github.com
Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa':
Hi skiing886! You've successfully authenticated, but GitHub does not provide
shell access.
也许,你并没有这么幸运,你也许会得到一个诸如"验证失败的提示",不要急,可能你的ssh还没有设置私钥
$ ssh-keygen -t rsa -C "skiing886@163.com" //为ssh生成一个私钥 路劲一般在 ~/.ssh/下面
$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa //为ssh添加私钥
$ ssh-add -l //查看私钥