zoukankan      html  css  js  c++  java
  • git上传到GitHub

    Quick setup — if you’ve done this kind of thing before
    or
    HTTPS
    SSH

    Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

    …or create a new repository on the command line
    echo "# bookmark" >> README.md
    git init
    git add README.md
    git commit -m "first commit"

    git push -u origin master
    …or push an existing repository from the command line

    git push -u origin master
    覆盖上传
    echo "# bookmark" >>
    git init
    git add .
    git commit -m "first commit"

    git push -fu origin master
    …or push an existing repository from the command line

    git push -u origin master
    …or import code from another repository
    You can initialize this repository with code from a Subversion, Mercurial, or TFS project.# TestAI
    # bookmark
    记录一些使用git过程中的bug

    RT ! [rejected] master -> master (fetch first)

    在push远程服务器的时候发现出现此错误;原因是没有同步远程的master

    所以我们需要先同步一下

    a.--> git pull origin master

    b.--> git push origin master
    ---------------------
    3、解决方案

    1)方案一

    ①使用在linux本地git工作目录,使用 git pull --rebase origin master 命令,将远程gitlab仓库更新下载到本地

    ②再次使用 git push -u origin master 命令上传

    但是这种办法依然报了如上错误

    2)方案二

    ①使用 git clone git@github.com:+地址名字;命令,将远程仓库克隆到本地

    ②再次提交至本地仓库:vim xxx.txt --> git add . --> git commit -m "add xxx"

    ③使用 git push -u origin master 命令上传至远程仓库

    ok!

    # bookmark
    # bookmark
    会在当前目录下创建一个名为 “libgit2” 的目录,并在这个目录下初始化一个 .git 文件夹, 从远程仓库拉取下所有数据放入 .git 文件夹,然后从中读取最新版本的文件的拷贝。 如果你进入到这个新建的 libgit2 文件夹,你会发现所有的项目文件已经在里面了,准备就绪等待后续的开发和使用。

    如果你想在克隆远程仓库的时候,自定义本地仓库的名字,你可以通过额外的参数指定新的目录名:

    $ git clone https://github.com/+地址名字 mylibgit
    这会执行与上一条命令相同的操作,但目标目录名变为了 mylibgit。

    Git 支持多种数据传输协议。 上面的例子使用的是 https:// 协议,不过你也可以使用 git:// 协议或者使用 SSH 传输协议,比如 user@server:path/to/repo.git 。 在服务器上搭建 Git 将会介绍所有这些协议在服务器端如何配置使用,以及各种方式之间的利弊。

  • 相关阅读:
    elasticsearch 数据迁移
    elasticsearch使用简介 -安装篇
    docker 使用笔记
    PHP 全局变量
    做人做事需牢记20条原则
    MYSQL 存储引擎概述
    postgresql常用命令
    ORACLE 清理SYSAUX表空间
    sqlserver数据库的启动
    postgressql启动与关闭
  • 原文地址:https://www.cnblogs.com/linyinmobayu/p/14261244.html
Copyright © 2011-2022 走看看