Mac之Git/GitHub使用(2)——Create A Repo

2014-04-06 wcdj


摘要:前文《MacGit/GitHub使用(1)——Set up Git 》介绍了如何在Mac上通过git关联和使用GitHub的方法。本文继续介绍下Create  A Repo的方法。


Make a new repository on GitHub

Every time you make a commit with Git, it is stored in a repository (a.k.a. "repo"). To put your project up on GitHub, you'll need to have a GitHub repository for it to live in.

如何把本地的git repo和GitHub repo联系起来呢?


(1) 在GitHub的个人账户上可以创建一个repo。



例如,创建一个nodejs-code的repo,注意我们没有选择创建默认的README。



Congratulations! You have successfully created your first repository!


Create a README for your repository

While a README isn't a required part of a GitHub repository, it is a very good idea to have one. READMEs are a great place to describe your project or add some documentation such as how to install or use your project. You might want to include contact information - if your project becomes popular people will want to help you out.



README用于介绍创建的repo的相关信息,更多关于README的高级用法,可以参考:https://github.com/github/markup。点击Create repository按钮后,可以看到如下的操作提示,主要有以下几个步骤:

Step 1: Create the README file

Step 2: Commit your README 

Step 3: Push your commit



Now that you have your README set up, it's time to commit it. A commit is essentially a snapshot of all the files in your project at a particular point in time.

注意:在GitHub上不要上传过大的文件,包括一些库、二进制文件、压缩包等。


So far, everything you've done has been in your local repository, meaning you still haven't done anything on GitHub yet. To connect your local repository to your GitHub account, you will need to set a remote for your repository and push your commits to it.

到目前为止,我们所有的改动都是发生在本地的,所以需要将本地的改动commit到远程的GitHub上。


回到我们刚创建好的repo中,我们根据提示执行命令:



修改成下面的方法就可以向远程的GitHub commit文件(README.md)了。其中,使用https://github.com/gerryyang/nodejs-code的访问方式只能在浏览器里操作,所以改成ssh的后台登陆方式来与远程的GitHub进行交互了,关于如何Add SSH Key,第一篇文章里有介绍。



Now if you look at your repository on GitHub, you will see your README has been added to it.

提交成功后,现在就可以在GitHub上看到我们刚提交的README.md文件了。



Celebrate

Congratulations! You have now created a repository on GitHub, created a README, committed it, and pushed it to GitHub. What do you want to do next?


参考

[1] https://help.github.com/articles/create-a-repo




  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值