IDEA 分享项目到 [email protected]
http://my.oschina.net/fdblog/blog/221195
前言:在正常的项目开发里面,我们一般是先有项目,然后再建立版本管理的,所以如果是先在Git@OSC 建立项目然后clone下来,再提交的话,我这种处女座的人总是会很不爽的。。。
首先,我们解决的情况是,已经有了一个正在开发的项目,现在我们要把他分享到[email protected]上面去。
1.第一步,当然是先在[email protected]上创建仓库,拿到[email protected]仓库的HTTP连接http://git.oschina.net/***/***.git
2.如果我们的本地项目是非git项目,那我们要先把它变成git项目
在intellij中 VCS——Import into Version Control——Create Git Repository——选择你的本地项目
3.通过git shell (可以安装git for window) 进入到项目目录 执行 以下命令
1
2
3
4
5
6
|
# 给项目设置远程远程仓库 # git remote add origin http: //git .oschina.net/***/***.git
# 抓取远程仓库数据,并自动合并远程分支 # git pull origin master # 更新本地数据到[email protected] # git push origin master |
如果pull或者push失败 请参考git提示进行解决 比如已经有remote地址 可以git remote rm origin清除
这样项目就提交到[email protected]了,以后本地的再有修改提交仓库就可以直接使用IDEA来进行统一的push操作