天天看点

How to use bitBucket with EGit in Eclipse,如何在Eclipse中使用bitbucket远程仓库

原文链接:http://wangpidong.blogspot.com.es/2012/05/how-to-use-bitbucket-with-egit-in.html

本文的的撰写是基于git的,由于bitbucket支持免费的私有仓库,因而便于私有化的个人源码管理,以避免源码开源泄露(github目前不支持免费的源码库托管),但又同时添加了远程仓库来托管,实时备份本地git仓库。

在Eclipse中使用egit进行协同开发,基本步骤如下:

1,安装EGit(http://www.eclipse.org/egit/),也可以使用Eclipse自身的Eclipse MarketPlace;

2,创建Eclipse工程,如HelloWorld,

右键选择Team->Share project,将创建好的project添加到Git的版本控制之中,完成之后,再次右键 Team->Add to index,将project中的所有文件放入Git 工作区,完成之后,右键Team->Commit,将文件进行Git commit

3,登入Bitbucket.org的账户

4,在Eclipse中配置SSH

选择Window->Preference->General->Network Connections->SSH2,如果你之前没有SSH keys,则选择Key Management -> Generate RSA Key生成新的RSA密钥对。在文本域里你会看到公钥,复制下来,添加到bitbucket账户的SSH keys(Account->SSH keys)中,并且保存好刚才生成的 RSA私钥(Save Private Key)至本地目录。并且在General中Add Private Key.来添加刚才保存的私钥文件

5,在bitbucket.org中,创建一个与Eclipse Project同名(HelloWorld)的项目工程,其SSH url为

ssh://[email protected]/myaccount/HelloWorld.git

6,在Eclipse的HelloWorld  Project上右键,Team->Remote->Push,键入SSH URL,点击Next

7,点击Add all branches spec,然后Next

8,点击OK,完成push。