入门GitHub

一、注册GitHub账号,下载安装git 

 

注册GitHub账号略,下载安装git一路next,安装完成

 

二、需要配置git,上传公钥。这里以windows为例

 

1、配置git_home,添加到path,这已经是基本素养了

2、生成ssh公钥,命令行执行:

ssh-keygen -t rsa -C "[email protected]"

如果提示错误Could not create directory '//.ssh',需要设置环境变量“home"--->"你的home目录" 

3、将刚刚生成的id_rsa.pub文件,使用编辑器打开,提交到GitHub的账号的SSH keys中去

4、测试命令:ssh -T [email protected],  yes后看到下面信息,说明提交SSH key成功

Hi "username"! You're successfully authentiated,but GitHub does not provide shell access

 

三、配置好git客户端的个人信息,用于说明代码谁提交的,还可以email联系

 

git config --global user.name "your name"

git config --global user.email "[email protected]"

 

四、真正的修改和提交代码

 

1、clone 仓库到本地  git clone [email protected]:zwustudy/HelloPython.git

2、添加文件到缓冲区  git add <filename>  /  git add *

3、git rm --cached "文件路径",不删除物理文件,仅将该文件从缓存中删除;

             git rm --f "文件路径",不仅将文件从缓冲区中删除,还会物理删除文件(不回回收到垃圾桶)

4、提交修改到本地仓库的HEAD版本中 git commit -m "修改的comment信息"

5、同步改动到远端仓库  git push origin master  master可以换成你想要推送的任何分支

 

补充:commit 的时候如果发生乱码: git config --global i18n.commitencoding utf-8   

参考资料:

1、http://liuzhijun.iteye.com/blog/1457207

2、http://www.bootcss.com/p/git-guide/

3、http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/

       

猜你喜欢

转载自zwustudy.iteye.com/blog/2235812