Eclipse配置GitHub

来源:互联网 发布:4g网络接收器 编辑:程序博客网 时间:2024/05/24 06:30
安装git for eclipse

http://marketplace.eclipse.org/content/egit-git-team-provider#.VFs0ctx9d6c

2、在Eclipse中生public key, 并添加到GitHub Repository中。

在菜单栏依次打开window → preference → general → network connection → SSH2 → Key Management → generate RSA Key... → apply → save private key...
生成 SSH 的 public key在GitHub中通过:edit your profile -> ssh key -> Add SSH Key 添加SSH Key, 把上面生成的 public key 拷贝到这里,保存。
本地安装maven并在eclipse里配置到安装目录   指定user setting到maven的conf目录下的setting.xml文件并update
新建maven项目  点击team→share project,-->create repository
在项目上点右键–>team–>commit。commit是commit到本机的git库,而push才是同步到github。
在弹出窗口输入你的GitHub 用户名和邮箱
提交文件到本地,并推送到服务器
然后在github网址上新建此名称的项目
再回到eclipse 项目-Team-remote-push-refs/heads/master->Add spec ->force Update -finish  输入github用户名与密码
导出仓库中项目到本机
先在eclipse的仓库中从远程clonel到本地, 然后在eclipse file import git local就可以
更新先执行fetch然后执行rebase就完成了更新
C:\Users\Colonel.Hou\.gitconfig配置如下:
[user]
name = Colonel.Hou
email = edric_net_hou2008@163.com
[core]
    repositoryformatversion = 0
    filemode = false
    logallrefupdates = true
[branch "master"] 
remote = origin 
merge = refs/heads/master 
[remote "origin"]
url = https://github.com/ColonelHou/GitHub.git

    fetch = +refs/heads/*:refs/remotes/origin/*


本地开发上传到GitHub

1.Github上创建项目
2.eclipse里创建项目
3.右击项目Team->share project->git->finish
4.右击项目Team->Commit
5.右击项目Team->remote->push(第一次提示用户名以及密码等)->next->Source ref(master)->Add Spec->Force Update-> Finish


1.通过【Window -> Show View -> Git Repositories】打开Git Repositories视图
2.在视图里选自【Clone a Git Repository】
3.把Github上工程的SSH访问的URL拷贝到URI里面。输入口令,Next>
4.选择要Clone的branch名,一般是master。Next>
5.选择要Clone到本的的哪个位置,注意最好不要选择Eclipse的workspace目录。Check上【Import all existing projects after clone finishes】就能够在clone完成后自动把工程导入到Eclipse里。Finish。

剩下的就交给Eclipse自动完成了。
成功以后Eclipse Repositories视图里会出现Clone后的本地git库,Project视图里面会出现导入的工程。
0 0
原创粉丝点击