设为首页 收藏本站
查看: 1413|回复: 0

[经验分享] idea中如何配置git以及在idea中初始化git

[复制链接]

尚未签到

发表于 2018-1-13 06:32:48 | 显示全部楼层 |阅读模式
  idea中如何配置git以及在idea中初始化git呢:
  参考此博文:
  http://blog.csdn.net/qq_28867949/article/details/73012300
  *为了这个问题折腾了半天...在这里记录下,方便大参考,欢迎评论提出宝贵意见,谢谢!**
  问题说明:
DSC0000.jpg

DSC0001.jpg

  解决方法一:
  ◆打开IDEA,按照路径  Fie--》Settings --》 Tools --》Terminal 找到后设置右边的Shell path(自己安装的Git路径下相对位置),如下图所示
   DSC0002.jpg
   DSC0003.jpg
  不完美之处:当我们点击idea中的Terminal终端时,会自动弹出Windows安装的bash窗口,如下图所示:
DSC0004.jpg

  解决方法二:
  ◆更改路径即可
git\bin\bash.exe
或 Git\bin\sh.exe
然后重新启动idea即可
   DSC0005.jpg
  
  ********************88注意:每次更改完成后需要重新启动IDEA******************
  =============================记录End=============================
  git在idea中使用:
  (1)创建README.md文件
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ touch README.md
  (2)创建.gitignore文件(用于忽略上传的文件)
  

#提交到码云上面忽略的东西配置  

  
*.class
  
#package file
  
*.war
  
*.ear
  
*.orig
  

  
target/
  
.settings/
  
.project
  
.classpath
  

  
.idea/
  
/idea/
  
*.ipr
  
*.iml
  
*.iws
  

  
*.log
  
*.cache
  
*.diff
  
*.patch
  
*.tmp
  

  
.DS_Store
  
Thumbs.db
  

  

  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ touch .gitignore
  (3)初始化git
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git init
  Initialized empty Git repository in F:/workspace/imallproject/.git/
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  查看git状态:现在是在master上(一般分支开发主干合并)
  $ git status
  On branch master
  (4)commit提示错误,先git add一下
  Initial commit
  Untracked files:
  (use "git add <file>..." to include in what will be committed)
  .gitignore
  README.md
  pom.xml
  src/
  nothing added to commit but untracked files present (use "git add" to track)
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git add .
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git status
  On branch master
  Initial commit
  Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
  new file:   .gitignore
  new file:   README.md
  new file:   pom.xml
  new file:   src/main/webapp/WEB-INF/web.xml
  new file:   src/main/webapp/index.jsp
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git commit -am 'first commit '
[master (root-commit) 5ef0663] first commit

  5 files changed, 65 insertions(+)
  create mode 100644 .gitignore
  create mode 100644 README.md
  create mode 100644 pom.xml
  create mode 100644 src/main/webapp/WEB-INF/web.xml
  create mode 100644 src/main/webapp/index.jsp
  git连接到码云仓库:
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git remote add origin git@git.oschina.net:marrymayun/imalllearning.git
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git branch
  * master
  (5)推送
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git push -u origin master
  The authenticity of host 'git.oschina.net (120.55.226.24)' can't be established.
  ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
  Are you sure you want to continue connecting (yes/no)? no
  Host key verification failed.
  fatal: Could not read from remote repository.
  Please make sure you have the correct access rights
  and the repository exists.
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git pull
  The authenticity of host 'git.oschina.net (120.55.226.24)' can't be established.
  ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
  Are you sure you want to continue connecting (yes/no)? yes
  Warning: Permanently added 'git.oschina.net,120.55.226.24' (ECDSA) to the list of known hosts.
  warning: no common commits
  remote: Counting objects: 4, done.
  remote: Compressing objects: 100% (3/3), done.
  remote: Total 4 (delta 0), reused 0 (delta 0)
  Unpacking objects: 100% (4/4), done.
  From git.oschina.net:marrymayun/imalllearning
  * [new branch]      master     -> origin/master
  There is no tracking information for the current branch.
  Please specify which branch you want to merge with.
  See git-pull(1) for details.
  git pull <remote> <branch>
  If you wish to set tracking information for this branch you can do so with:
  git branch --set-upstream-to=origin/<branch> master
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git push -u -f origin master
  Counting objects: 11, done.
  Delta compression using up to 4 threads.
  Compressing objects: 100% (7/7), done.
  Writing objects: 100% (11/11), 1.29 KiB | 0 bytes/s, done.
  Total 11 (delta 0), reused 0 (delta 0)
  To git@git.oschina.net:marrymayun/imalllearning.git
  + a5a27d2...5ef0663 master -> master (forced update)
  Branch master set up to track remote branch master from origin.
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git branch
  * master
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git branch -r
  origin/master
  在master下创建分支v1.0
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (master)
  $ git checkout -b v1.0 origin/master
  Branch v1.0 set up to track remote branch master from origin.
  Switched to a new branch 'v1.0'
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (v1.0)
  $ git branch
  master
  * v1.0
  推送到分支,我们在分支开发,主干合并
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (v1.0)
  $ git push origin HEAD -u
  Total 0 (delta 0), reused 0 (delta 0)
  To git@git.oschina.net:marrymayun/imalllearning.git
  * [new branch]      HEAD -> v1.0
  Branch v1.0 set up to track remote branch v1.0 from origin.
  fengli@DESKTOP-FEQ1N4I MINGW32 /f/workspace/imallproject (v1.0)
  $
  完成:

  至此在idea中初始化git完成。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-434517-1-1.html 上篇帖子: Git 同步远程仓库 下篇帖子: 如何选择版本控制系统
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表