zoukankan      html  css  js  c++  java
  • github提交代码

    在linux下搭建git环境
    1、创建Github账号,https://github.com
    2、Linux创建SSH密钥:

    [plain] view plain copy
     
    1. ssh-keygen  ##一直默认就可以了  

    3、将公钥加入到Github账户信息Account Settings->SSH Key
    4、测试验证是否成功。

    [plain] view plain copy
     
    1. ssh -T git@github.com  
    2. Hi someone! You've successfully authenticated, but GitHub does not provide shell access.  


    同步github到本地
    1、复制项目到本地:

    [plain] view plain copy
     
    1. git clone git://github.com:xxxx/test.git ##以gitreadonly方式克隆到本地,只可以读  
    2. git clone git@github.com:xxx/test.git  ##以SSH方式克隆到本地,可以读写  
    3. git clone https://github.com/xxx/test.git ##以https方式克隆到本地,可以读写  
    4. git fetch git@github.com:xxx/xxx.git  ##获取到本地但不合并  
    5. git pull git@github.com:xxx/xxx.git ##获取并合并内容到本地  


    本地提交项目到github
    1、本地配置

    [plain] view plain copy
     
    1. git config --global user.name 'onovps'  
    2. git config --global user.email 'onovps@onovps.com' #全局联系方式,可选  

    2、新建Git项目并提交到Github。

    [plain] view plain copy
     
    1. mkdir testdir & cd testdir  
    2. touch README.md  
    3. git init #初始化一个本地库  
    4. git add README.md #添加文件到本地仓库  
    5. git rm README.md #本地倒库内删除  
    6. git commit -m "first commit" #提交到本地库并备注,此时变更仍在本地。  
    7. git commit -a  ##自动更新变化的文件,a可以理解为auto  
    8. git remote add xxx git@github.com:xxx/xxx.git  #增加一个远程服务器的别名。  
    9. git remote rm xxx   ##删除远程版本库的别名  
    10. git push -u remotename master #将本地文件提交到Github的remoname版本库中。此时才更新了本地变更到github服务上。  
     


    git命令使用思维图:【非常有料】

    http://www.cnblogs.com/1-2-3/archive/2010/07/18/git-commands.html

    git 查看单独一个文件的修改历史

    1. git log filename
    可以看到fileName相关的commit记录
    2. git log -p filenam
    可以显示每次提交的diff
    3. 只看某次提交中的某个文件变化,可以直接加上fileName
    git show c5e69804bbd9725b5dece57f8cbece4a96b9f80b filename

  • 相关阅读:
    机器学习算法及应用领域相关的中国大牛[转]
    Awesome (and Free) Data Science Books[转]
    机器学习算法之旅【翻译】【转】
    const 引用的分析
    c++ 引用的分析
    读取BMP图像size的时候与操作和左移的原因
    java的equal和==问题
    mac10.9下安装Android
    c++设计模式系列----builder模式
    c++设计模式系列----单例模式(Singleton模式
  • 原文地址:https://www.cnblogs.com/guxuanqing/p/5339785.html
Copyright © 2011-2022 走看看