一、注册github,并建立代码库 linux
地址:https://github.com/ git
注册github,登录后, 点击右上角 “Create a new repo” 按钮,Repository name输入Hello-world, 选中 public ,github
点击Create repository按钮,库建立成功。shell
二、安装git,并设置git 测试
下载地址http://code.google.com/p/git-core/downloads/list google
安装完git后,执行:spa
git config --global user.name "Your Name Here" git config --global user.email "your_email@youremail.com"
user.name 为全局的用户名code
user.email 为github的注册邮箱,用于与github关联。 ip
三、建立本地库,并提交原始版本文件 rem
在主目录中建立Hello-world目录,进入该目录,执行git init,出现.git的隐藏子目录;建立README文件做为测试提交的文件,vi编辑该文件输入Hello World!.
cd ~/Hello-world git init touch README
四、提交原始版本文件
git add README git commit -m 'first commit'
将README提交,此时并不影响 远程github的库。
五、PUSH到远程github
git remote add origin https://github.com/username/Hello-World.git git push origin master
其中https地址能够在github上找到。
shipley@linux-vo4i:~/Hello-world> git push origin master
Username for 'https://github.com': username
Password for 'https://hsp8712@github.com': ******
Counting objects: 3, done.
Writing objects: 100% (3/3), 216 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/hsp8712/Hello-world.git
* [new branch] master -> master
提交成功