Github for Windows——来自Github官方的Git客户端

2013-08-05

Github-for-Windows

最近因为需要使用Git管理代码,所以向来对Git不甚感冒的我,也不得不学习使用Git了。要用Git管理代码,Git客户端自然必不可少,可上网一搜,Windows下的Git客户端软件还真不多——Github for Windows,TortoiseGit和SmartGit。

鉴于Github for WindowsGithub官方出的,所以我就选择了这个。我记得第一次使用Github for Windows时,我一看还得这货还得登陆Github账户,便误以为只能管理Github库,便就立刻卸载掉了。到了今天我才知道,原来这货也可以管理其他Git库……

Github for Windows添加库十分简单,以京东代码库为例,只要选中“代码库首页”的URL(如https://code.jd.com/mawenjian/jae_appname),将其拖入Github for Windows窗口,待下面显示“drop anywhere to clone”松手即可。而后,输入用户名和密码,就开始导入代码了。

官方说明如下:

You can add any repository already on your hard drive by dragging a folder in from Explorer. If that folder is a Git repository, GitHub for Windows will import all of the history and connect it to your GitHub accounts.

至于提交代码,也很简单,待修改完成后添加注释,再选择“Commit”提交即可。不过我第一次提交代码时,GfW竟然提示“Commit failed:Failed to create a new commit”错误,我还以为这货有BUG呢。

好在我从StackOverflow找到了解决方案:

1.打开PowerShell窗口,输入 "git add [file name]" 命令提交文件;

2.输入"git status"命令,查看那些文件被提交,其中绿色标记是提交成功的,红色标记是没有提交成功的;

3.当所有文件都被提交后,输入"git commit"命令。

到了这里,我遇到的问题提示是没有配置用户名和邮箱(大概这个意思)。然后我按照提示配置好用户名和邮箱,再提交代码就没有问题了。

StackOverflow英文解释如下:

Try opening up PowerShell and manually committing each file using the "git add [file name]" command. To see which files have been committed, enter "git status" into the command line. The green files have been committed, the red ones uncommitted.

Once you've committed them all, type "git commit." Then go back to Github for Windows and sync it up.

I'm not sure what causes this issue, but once I followed the above steps, Github went back to its normal, awesome behavior.


除非特殊说明,本博客文章均为原创,转载请以链接形式标明博文地址。

本文链接地址: Github for Windows——来自Github官方的Git客户端

分类:互联网 | 标签: |

15条评论

  1. www.liguangliang.com.cn说道:

    学习了,

  2. 不错说道:

    github客户端不错,可惜没有中文版,在网上找到一篇是图文教程还是不错的。
    http://www.ihref.com/read-16514.html

  3. kslr说道:

    嘿嘿 你流程搞反了

  4. 郑杰说道:

    国内的各种XAE间接推广了SVN,不过我还是喜欢Git,Linux上面用起来方便。

  5. ivmm说道:

    git我也不会,只会svn

  6. 小V说道:

    没怎么用过Github

回复 kslr 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注