• github管理开发代码流程


    首先。通过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
    
  • 相关阅读:
    Windows API 的数据类型与 Delphi 数据类型对照表
    Delphi 编译错误信息表
    Delphi中的容器类
    Delphi 快捷键
    代码折叠
    [转]Delphi中record的使用
    [转]常用公共函数单元
    Delphi 运行时错误信息表
    C#调用Win32 的API函数User32.dll
    [转]Delphi程序启动参数的读取
  • 原文地址:https://www.cnblogs.com/archrjoe/p/4055395.html
Copyright © 2020-2023  润新知