[从零开始系列]windows上如何github使用(参考 github help)

3 篇文章 0 订阅


Build software better, together.

Powerful collaboration, review, and code management for open source and private development projects.

基于Rails的Git库托管

GitHub可以托管各种git库,并提供一个web界面,但与其它像 SourceForgeGoogle Code这样的服务不同,GitHub的独特卖点在于从另外一个项目进行分支的简易性。为一个项目贡献代码非常简单:首先点击项目站点的“fork”的按 钮,然后将代码检出并将修改加入到刚才分出的代码库中,最后通过内建的“pull request”机制向项目负责人申请代码合并。

https://github.com/

1.注册

这里就不废话了

2.Set Up Git,设置Git

下载最新版本的Git,GitHub上提供了一个地址:http://github-windows.s3.amazonaws.com/GitHubSetup.exe

Windows版本的可以去这里下载:http://code.google.com/p/msysgit/


安装好之后,打开Git Bash

Now that you have Git installed, it's time to configure your settings. To do this you need to open Git Bash (not the Windows command line).

开始做一些简单的配置。配置user.name和user.email


(1)First you need to tell git your name, so that it can properly label the commits you make.

设置Git的user.name,方便标定你每次的Commit

git config --global user.name "Your Name Here"

(2)Git saves your email address into the commits you make. We use the email address to associate your commits with your GitHub account.

设置Git的user.email,每一次的Commit,Git都会保存你的Email。Github会根据这个email,将你的commits和github账号关联起来。

git config --global user.email "your_email@youremail.com"

Your email address for Git should be the same one associated with your GitHub account. If it is not, see  this guide  for help adding additional emails to your GitHub account. If you want to keep your email address hidden,  this guide  may be useful to you.

一般情况下,你git的email应该和你的github账号的email相同。

The steps listed above show you how to set your user info globally. This means that no matter which repository you work in on your computer, you'll be making commits as that user. If you find yourself needing to make commits with different user info for a specific repository (perhaps for work vs. personal projects), you will have to change the info in that repository itself.

设置user.name和user.email是为了让git记录每次提交的人是谁,之前设置是global的user.name,那么无论你在那个仓库提交,你的名字都是他,如果你希望在指定的仓库中提交时,使用指定的名字,你可以进入该仓库的文件夹,输入:

$cd my_other_repo
# Changes the working directory to the repository you need to switch info for
$git config user.name "Different Name"
# Sets the user's name for this specific repository
$git config user.email "differentemail@email.com"
# Sets the user's email for this specific repository

关于github的ssh密钥http://blog.csdn.net/benw1988/article/details/8492968


3.Create A Repo 创建仓库

登录Github,点击New Repository


然后看着填吧



填一个Repository Name就可以了,其他的,README可以初始化,也可以不初始化,下一步就是直接在GitHash里面创建一个README。

打开你的gitbash

(1)创建一个README


(2)Commit你的README

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. In the prompt, type the following code:

README建立好,之后,可以进行commit。一次commit是在特定时间点上你工程下所有文件的快照。


Think of a commit as a snapshot of your project — code, files, everything — at a particular point in time. After your first commit git will only save the files that have changed, thus saving space.

commit是你的项目的快照,代码,文件,所有的东西,在某一个时间点的快照。commit会保存你修改的文件。

(3)Push你的Commit

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 repo and push your commits to it:

到目前为止,你在本地的仓库进行了操作,但是你还没有push到Github远程服务器的仓库。


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

可以到你的Github上去看,是否有更新。

remote is a repository stored on another computer, in this case on GitHub's server. It is standard practice (and also the default in some cases) to give the name origin to the remote that points to your main offsite repository (for example, your GitHub repository).

remote是一个存在另一台计算机上的仓库,这里是Github的server。

Git supports multiple remotes. This is commonly used when forking a repository.


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值