首先。通过github网站新建一个仓库,得到仓库地址

https://github.com/piercalex/a.git

接着回到客户端,打开git shell:

//在客户端配置账户信息
git config --global user.name 'piercalex' //设置初始账号id
git config --global user.email 'lijunal@126.com' //设置邮箱
//在本地建立自己的版本仓库
cd d: //我把版本仓库建立在D盘,切换到D盘目录
mkdir a //新建文件夹,注意本地仓库名要和git上建立的仓库名一致
cd a //进入a目录
git init //初始化版本仓库
touch README //建立一个README文件,之后编辑README
git add README //将文件添加到上传队列
git commit -m 'information' //提交
git remote add origin https://github.com/piercalex/a.git //远程地址
//如果这里有错,错误信息为fatal: remote origin already exists时,请输入:git remote rm origin,然后继续输入上面那行继续走流程。
git push origin master //上传到远程版本库。输入github邮箱和密码

ok,已经完成github线上建立仓库和线下仓库关联。

新建远程分支,分账号先登录git config设置完毕,去github页面上找到源目录,fork先。

git clone https://github.com/piercalex/a.git //克隆,并在本地目录自动建立本地仓库
cd a
git checkout -b dev //建立并切换到dev分支
git push --set-upstream origin dev //向主分支提交新建分支信息
//输入主分支邮箱和密码,通过。远程分支建立完毕
//编辑内容
git add .
git commit -m 'add dev' //汇总目录
git push //提交

远程分支工作完毕,回到master工作环境:

git checkout master
git merge dev --no-ff //merge合并工作先
git pull origin dev //从dev分支拉回较新代码
git push //更新至master账号下面,共其他分支pull

当出现以下错误时:

Permission denied (publickey).
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists.

解决办法:

ls -al ~/.ssh //check for SSH keys
ssh-keygen -t rsa -C "lijunal@126.com" //generate a new SSH keys
//enter后,输入两次passphrase,之后生成了SSH key
pbcopy < ~/.ssh/id_rsa.pub //拷贝公有秘钥,到github上"add SSH key"
ssh -T git@github.com //输入passphrase后连接成功!

  

SSH keys已经添加的情况下,git每次提交都需要输入账号密码的解决办法:(所使用的git地址是https服务,需要修改ssh服务)

git remote -v //查询链接方式
# origin https://github.com/USERNAME/REPOSITORY.git(fetch)
# origin https://github.com/USERNAME/REPOSITORY.git(push) git remote set-url origin git@github.com:USERNAME/REPOSITORY.git git remote -v //再次执行查询
# origin git@github.com:USERNAME/REPOSITORY.git(fetch)
# origin git@github.com:USERNAME/REPOSITORY.git(push)

  

Git Bash中输入中文不能正确显示,而是变成Unicode时

git config --global core.quotepath false

  

Git忽略已存在的文件,先.ignore添加内容,然后

git rm --cached logs/xx.log

Git mergetool不再生成烦人的备份文件(*.orig)

git config --global mergetool.keepBackup false

The file will have its original line endings inyour working directory.//当报这个警告时是由于文件夹远程不存在,但是不影响提交

git config --global core.autocrlf false

github管理开发代码流程的更多相关文章

  1. github提交代码流程:

    (1)  检查一遍代码改动          $git status (2) 将工作目录中的代码提交到暂存区 $ git add filename     git add -A (3)  提交代码到本 ...

  2. 往github提交代码流程

    一 首先在Github新建一个仓库,回到首页,点击右上角的New repository新建仓库. 二  在本地依次使用下面命令 …or create a new repository on the c ...

  3. GitHub团队协作流程

    说来惭愧,这么长时间,第一次参与修改开源项目,所以整理了一份GitHub团队协作流程,作为备忘,文章大部分内容参考https://www.cnblogs.com/schaepher/p/4933873 ...

  4. bluetooth(蓝牙) AVRCP协议概念及代码流程解析

    一 概念 AVRCP全称:The Audio/Video Remote Control Profile (AVRCP) 翻译成中文就是:音视频远程控制协议.概念:AVRCP定义了蓝牙设备之间的音视频传 ...

  5. 转:GitHub团队项目合作流程

    转自:https://www.cnblogs.com/schaepher/p/4933873.html GitHub团队项目合作流程   已在另一篇博客中写出关于以下问题的解决,点此进入: 同步团队项 ...

  6. github提交代码时,报permission denied publickey

    在像github提交代码时,报permission denied publickey. 查找了一下,可能是因为github的key失效了. 按照以下步骤,重新生成key. ssh-keygen 一路默 ...

  7. 软工实践个人练习-使用github进行代码管理

    1.掌握使用Git进行代码版本,使用github进行代码托管. 2.创建小组Organization,并邀请组员进来. 3.将代码库https://github.com/sefzu2015/AutoC ...

  8. 【iOS技术】Xcode+GitHub远程代码托管(GIT, SVN)

    原创 2016-05-24 旭哥 蓝鸥 学生对旭哥的评价是这样的: 旭哥 为什么这么年轻 知识却比我们多这么多............ 旭哥很是负责,对同学的各种问题都能够热心地解答,在旭哥的带领下, ...

  9. 使用命令创建github代码仓库,push本地仓库到github远程代码仓库

    1.利用命令创建github远程代码仓库 在将本地代码push到github远程代码仓库之前,总是需要新建github代码仓库,在将本地仓库关联到github远程仓库.其中最为繁琐的操作是建立gith ...

随机推荐

  1. 本地搭建ELK(elasticsearch, logstash, kibana)日志收集系统

    环境准备:macos 预先安装brew包管理器 1.安装elasticsearch流程 那么,咱们先去安装java8 接着,咱们继续按照elasticsearch 接着,咱们启动elasticsear ...

  2. 安卓 运行、调试 配置 android Run/debug configurations

    android  运行.调试 配置 android  Run/debug configurations 作者:韩梦飞沙 Author:han_meng_fei_sha 邮箱:313134555@qq. ...

  3. NOIp模拟赛 现实(DP 拓扑)

    题目来源:by lzz \(Description\) 给定一张有向图,求对于哪些点,删除它和它的所有连边后,图没有环. \(n\leq 5\times10^5,m\leq 10^6\). \(Sol ...

  4. java给时间格式化

    package com.apress.springrecipes.sequence; import java.text.DateFormat;import java.text.SimpleDateFo ...

  5. linux tomcat 绑定域名

    1.解析域名到对应的服务器ip 2.找到tomcat安装路径进入/conf 3.vi server.xml 4.修改<Connector port="8080" protoc ...

  6. maven学习一(HelloWorld工程)

    maven是一个出色的java工程依赖管理的工具,刚刚开始学习用maven建立一个HelloWorld工程. maven安装 $ wget http://mirrors.cnnic.cn/apache ...

  7. mac环境下intellij的自定义配置文件位置

    ~/Library/Preferences/IntelliJIdea2017.2/

  8. GraphQL入门3(Mutation)

    创建一个新的支持Mutation的Schema. var GraphQLSchema = require('graphql').GraphQLSchema; var GraphQLObjectType ...

  9. NModbus类库使用

    通过串口进行通信 : 1.将 NMobus 类库导入工程中,添加引用.命名空间.工程属性必须配置 为 .NET 4.0. 2.创建 SerialPort 类的一个实例,配置参数,打开串口,如: pub ...

  10. 使用JDBC在MySQL数据库中快速批量插入数据

    使用JDBC连接MySQL数据库进行数据插入的时候,特别是大批量数据连续插入(10W+),如何提高效率呢? 在JDBC编程接口中Statement 有两个方法特别值得注意: void addBatch ...