美文网首页android
git 使用命令(1)

git 使用命令(1)

作者: 孙科技 | 来源:发表于2017-08-11 16:08 被阅读1次

    Git 全局设置:

    本地项目上传到git仓库

    下载git工具 https://git-scm.com/downloads,

    安装成功后,在需要上传的项目的文件下,打开下面的cmd ,依次输入以下命令

    #git config --global user.name "name"

    #git config --global user.email "email"

    #git init

    #git commit -m "first commit"

    #git remote add origin https://git.oschina.net/xxxi/xxx.git

    #git push -u origin master

    到此你的本地项目就成功上传到你的git仓库。

    补充:错误提示:fatal: remote origin already exists.

    提示出错信息:fatal: remote origin already exists.

    解决办法如下:

    1、先输入$ git remote rm origin

    2、再输入$ git remote add origin URL就不会报错了!

    3、如果输入$ git remote rm origin还是报错的话,error: Could not remove config section 'remote.origin'. 我们需要修改gitconfig文件的内容

    4、找到你的github的安装路径,我的是C:\Users\ASUS\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\etc

    5、找到一个名为gitconfig的文件,打开它把里面的[remote "origin"]那一行删掉就好了!

    提示出错信息:error:failed to push some refs to 'https://gitee.com/sunkeji/Wheel.git'

    git pull --rebase origin master

    执行后可以看到本地代码中多了README.md文件

    再次执行git push origin master即可完成代码上传

    git 推送出现 "fatal: The remote end hung up unexpectedly" 解决方案

    在使用git推送项目时候出现 "fatal: The remote end hung up unexpectedly " 原因是推送的文件太大。

    解决方案:

           在克隆/创建版本库生成的 .git目录下面修改生成的config文件增加如下:

    [http]

    postBuffer =524288000

    即修改提交缓存大小为500M

    补充:github仓库命令

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

    Set up in Desktop

    or

    HTTPS

    SSH

    We recommend every repository include aREADME,LICENSE, and.gitignore.

    …or create a new repository on the command line

    echo "# wheel" >> README.mdgit initgit add README.mdgit commit -m "first commit"git remote add originhttps://github.com/sunkeji/wheel.gitgit push -u origin master

    …or push an existing repository from the command line

    git remote add originhttps://github.com/sunkeji/wheel.gitgit push -u origin master

    …or import code from another repository

    You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

    Import code

    相关文章

      网友评论

        本文标题:git 使用命令(1)

        本文链接:https://www.haomeiwen.com/subject/xzfrrxtx.html