配置用户名:$ git config --glob user.name "forever"
配置邮箱:$ git config --glob user.email "*******@163.com"
不管换行:$ git config --glob core.autocrlf false
 
编码:$ git config --glob gui.encoding  utf-8
避免git status乱码:$ git config --glob core.quotepath off
 
windows:
$ git config --glob core.ignorecase  false
 
$ ssh-keygen -t rsa -C "****@163.com"
$ eval `ssh-agent`
$ ssh-add ~/.ssh/id_rsa
 
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL9BRs1EJbHaOi32W042X/hVY/DAJ2amBHvlm8zkYRcl7CS7f6Cwv+f/42Zw9oF/kjq1Rm9Mzjua8EMRVU/L7W1jeO158cs7shtCx97vcPu1q50zMCaj57J6XVZZCWvLWb484YUkY5PhgXLscc1Br5CfdDTAvNjfKQcKGo3cOSLPDqXoIb0MY1uvfyEluFQYZ/f+noY21Izug3cfn/zYGAM0FX5JHqkN6sitxMRHLVLsvbFehWDxnF*AubzxGSpP9sBX3KwwV1CQibt4Ej4XxJXCq5zNSWKaNj88LcSfAZ+2culfya7HFXeKcBItrbICJBT3BHa8z/TKanIQbJFbiV *****@163.com
 
登陆 https://gitee.com/  去
设置中添加
公钥
 
完成
然后添加项目
 
添加完成如下图:
添加记住远程git仓库地址:git@gitee.com:forever2015_LLH/test_learning.git
 
 
 
本地操作,idea 
1.添加忽略配置文件
 
配置文件内容
*.class
#package file
*.war
*.ear
 
*.orig
 
target/
 
#eclipse ignore
.settings/
.progect
.classpath
 
#idea
.idea/
/idea/
*.ipr
*.iml
*.iws
 
#tem file
*.log
*.cache
*.diifgit
*.patch
*.tmp
 
 
#system ignore
.DS_Store
Thumbs.db
 
 
 
首先执行  git init ->在执行git status 查看要上传的文件 -> 添加 git add . ->在查看看到文件变化->在执行git commit(-am  '注释') 提交到本地仓库->提交到远程仓库地址 git remote add origin git@gitee.com:forever2015_LLH_liuluheng2015/test1.git
 
查看当前分支:git branch
推送到远程git仓库: git push -u origin master
 
会出先错误:
E:\Java\2015WorkSpace>git push -u origin master
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@gitee.com:forever2015_LLH/test_learning.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
 
拉取:
E:\Java\2015WorkSpace>git pull
warning: no common commits
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
* [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
 
落后于当前:再次失败
E:\Java\2015WorkSpace>git push -u origin master
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:forever2015_LLH/test_learning.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
 
(由于第一次所以强制推送)
E:\Java\2015WorkSpace>git push -u -f origin master
Counting objects: 18, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (18/18), 5.35 KiB | 0 bytes/s, done.
Total 18 (delta 0), reused 0 (delta 0)
remote: Powered by Gitee.com
+ a8d8c85...cdda889 master -> master (forced update)
Branch master set up to track remote branch master from origin.
 
查看远程分:git branch -r  然后根据主干创建本地分支
 
 
把本地分支推送到主干
 
git  push origin head -u
 
 
 
 
 
 
 
 
 

git在idea中的使用,如何构远程git方仓库的更多相关文章

  1. git上传中的排除的配置文件, git实际的操作代码;

    git上传中的排除的配置文件: git实际的操作 在主目录建立.gitignore文件并输入以下保存: *.class #package file *.war *.ear #kdiff3 ignore ...

  2. 【Git】工作中99%能用到的git命令

    Git使用笔记 1.第一次使用github ============================================= 1)github注册账号 使用邮箱注册账号 先不要创建版本库 2 ...

  3. Git 在团队中的使用--如何正确使用Git Flow

    Git的优点 Git的优点很多,但是这里只列出我认为非常突出的几点. 由于是分布式,所有本地库包含了远程库的所有内容. 优秀的分支模型,打分支以及合并分支,机器方便. 快速,在这个时间就是金钱的时代, ...

  4. git status 显示中文和解决中文乱码

    目录 git status 显示中文和解决中文乱码 解决git status不能显示中文 解决git bash 终端显示中文乱码 通过修改配置文件来解决中文乱码 git status 显示中文和解决中 ...

  5. 为Spring Cloud Config Server配置远程git仓库

    简介 虽然在开发过程,在本地创建git仓库操作起来非常方便,但是在实际项目应用中,多个项目组需要通过一个中心服务器来共享配置,所以Spring Cloud配置中心支持远程git仓库,以使分散的项目组更 ...

  6. git向远程git仓库提交代码步骤详解

    一.从远程仓库clone工程到本地 git clone -b 分支名称 http://10.1.1.11/service/tmall-service.git  localDestDirectory l ...

  7. git 初始化本地项目并推送到远程

    有一个新项目,开发了一些代码之后想推送到远程,具体的操作方式和命令如下: (使用 git bash) 1.切到项目目录中,例如 E:\git\smart-open 2.初始化git仓库并在本地提交 / ...

  8. Git 在团队中的最佳实践--如何正确使用Git Flow

    我们已经从SVN 切换到Git很多年了,现在几乎所有的项目都在使用Github管理, 本篇文章讲一下为什么使用Git, 以及如何在团队中正确使用. Git的优点 Git的优点很多,但是这里只列出我认为 ...

  9. [转]git在eclipse中的配置

    一_安装EGIT插件 http://download.eclipse.org/egit/updates/ 或者使用Eclipse Marketplace,搜索EGit 二_使用EGIT前的配置 配置个 ...

随机推荐

  1. linux下保存下位机输出的串口信息为文件

    linux下保存下位机输出的串口信息为文件 1.stty -F /dev/ttyUSB0 raw (转换成raw模式) 2.stty -F /dev/ttyUSB0 speed 115200 (设置波 ...

  2. kubernetes 命令记录

    操作基本命令:   通过yaml文件创建: kubectl create -f xxx.yaml (不建议使用,无法更新,必须先delete) kubectl apply -f xxx.yaml (创 ...

  3. excel在msdn上的说明文档

    Microsoft.Office.Tools.Excel.Worksheet 对象提供和 Excel 主互操作程序集中的 Microsoft.Office.Interop.Excel.Workshee ...

  4. C#中dll附加配置文件

    DLL-with-configuration-file带配置文件的dll http://www.codeproject.com/Tips/199441/DLL-with-configuration-f ...

  5. 【打分策略】Elasticsearch打分策略详解与explain手把手计算

    一.目的 一个搜索引擎使用的时候必定需要排序这个模块,一般情况下在不选择按照某一字段排序的情况下,都是按照打分的高低进行一个默认排序的,所以如果正式使用的话,必须对默认排序的打分策略有一个详细的了解才 ...

  6. Linux下指定pip install和make install安装路径

    在Linux下直接用pip install packageName,有些文件会被放到根目录下,如果没有sudo权限的话,是会安装失败的.这个以后我们就需要指定安装的目录了. pip install - ...

  7. rg.apache.ibatis.binding.BindingException: Mapper method 'com.dao.Cameao.getOnlineDayRation attempted to return null from a method with a primitive return type (float)

    本文为博主原创,未经允许不得转载: 异常展示如下: org.apache.ibatis.binding.BindingException: Mapper method 'com.dao.Cameao. ...

  8. java基础学习总结——线程(一)

    一.线程的基本概念

  9. spark必知必会的基本概念

    首先我们从宏观的视角来窥视下大数据技术框架: 图1 大数据技术框架 从图1可以看出,数据源-数据收集-数据存储-资源管理,这是我们进行数据分析和处理的基本;图中的计算框架包括批处理.交互式分析和流处理 ...

  10. C#中的?

    1. 可空类型修饰符(?):引用类型可以使用空引用表示一个不存在的值,而值类型通常不能表示为空.例如:string str=null; 是正确的,int i=null; 编译器就会报错.为了使值类型也 ...