配置用户名:$ 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. attr返回被选元素的属性值

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. NS3 Ptr<Rocket> 与 TcpRocket 的一个小问题

    前因:ns3网络仿真 实验进行到很关键的一步,我尝试进行了代码的编写(还没有添加Traceback的函数),如下: #include "ns3/core-module.h" #in ...

  3. ZOJ 3329 One Person Game (经典概率dp+有环方程求解)

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3329 题意:现在有三个骰子,分别有k1,k2和k3面,面上的点就是1~ki ...

  4. UVa 11991 一道简单题

    https://vjudge.net/problem/UVA-11991 题意:给出一个包含n个整数的数组,你需要回答若干询问.每次询问两个整数k和v,输出从左到右第k个v的下标. 思路: 把每个数字 ...

  5. POJ 1029 False coin

    http://poj.org/problem?id=1029 题意: 在一堆硬币中有一个假硬币,重量是重是轻不知道.每次称量多个硬币,并给出称量结果.判断依据题目给出的几次称量结果能否找出假硬币. 思 ...

  6. mysql 对比两个表的一致性

    -- A和B两个表 数据是否一致select 自定义 from A left join B on A.id = B.id where B.id is null 注释:这样查询的结果是A表中有而B表中没 ...

  7. MVC ---- T4模板的小练习

    1.先建立两个模板文件 :Manger.ttinclude.DBHelper.ttinclude Manger.ttinclude <#@ assembly name="System. ...

  8. shell 去掉字符串的单引号

    echo \'deded\' | sed $'s/\'//g'

  9. 编写一个截取字符串的函数,输入为一个字符串和字节数,输出为按字节截取的字符串。 但是要保证汉字不被截半个,如“我ABC”4,应该截为“我AB”,输入“我ABC汉DEF”,6,应该输出为“我ABC”而不是“我ABC+汉的半个”。

    一.需要分析 1.输入为一个字符串和字节数,输出为按字节截取的字符串--->按照字节[byte]截取操作字符串,先将String转换成byte类型 2.汉字不可以截半--->汉字截半的话对 ...

  10. threejs和particles.js

    particles.js 在线配置的东西: http://vincentgarreau.com/particles.js/ https://threejs.org/ http://thehuub.co ...