初试git+github(linux环境)

1、注册github,并创建代码库

        地址:https://github.com/

        注册github,登陆后, 点击右上角 “Create a new repo” 按钮,Repository name输入Hello-world, 选中 public ,

        点击Create repository按钮,库创建成功。

2、安装git,并设置git

        下载地址http://code.google.com/p/git-core/downloads/list

        安装完git后,执行:


git config --global user.name "Your Name Here"
git config --global user.email "your_email@youremail.com"

        user.name 为全局的用户名


        user.email 为github的注册邮箱,用于与github关联。        

3、创建本地库,并提交原始版本文件

        在主目录中创建Hello-world目录,进入该目录,执行git init,出现.git的隐藏子目录;创建README文件作为测试提交的文件,vi编辑该文件输入Hello World!. 

cd ~/Hello-world
git init
touch README

4、提交原始版本文件


git add README
git commit -m 'first commit'

       将README提交,此时并不影响 远程github的库。


5、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


提交成功



转载于:https://my.oschina.net/shipley/blog/98002

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值