首先关联github;
设置用户名 git config --global user.name "Leo";
邮箱 git config --global user.email "Leo@yqjinfu.com";
其次在github上创建一个账户;
执行 ssh-keygen -t rsa -C "Leo@yqjingu.com"生成一个秘钥 ,默认存放在C盘users文件夹下的Leo文件里,生成一个.ssh的文件夹;
打开该文件夹下的id_rsa.pud;拷贝里面的文档;
打开github账号,在setting页面,找到SSH and GPG,点击new SSH按钮,将秘钥粘贴到相应的位置;
通过命令ssh git@github.com 检测是否关联成功;
在本地git init建立一个repository;
新建文件夹 mkdir;
添加文件例如 git touch .gitignore;
先将文件提交到本地内存,git commit -a -m"first commit";
执行git push origin master;
根据提示,填写github账号及密码(初次推送时填写);
原文:http://www.cnblogs.com/zhangzq/p/6241285.html