git 使用命令(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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Add & Commit git init 初始化一个 Git 仓库(repository),即把当前所在目录变成...
    冬絮阅读 4,924评论 0 9
  • 查看、添加、提交、删除、找回,重置修改文件 git help # 显示command的helpgit show...
    L就问你开不开心阅读 308评论 0 0
  • 莫里斯·梅特林克,我并不熟悉的作者,查询才知道他被誉为“比利时莎士比亚”也是诺贝尔获得者。 之前看过的也只有《花的...
    乐播报阅读 527评论 0 1
  • 可怕的巨婴 武志红说我国是一个巨婴国,90%的人都是巨婴,物质身体已经成人但心理年龄在6个月、三岁多、6岁左...
    朵朵颐阅读 138评论 0 2
  • 暖心的小事时常有之比你巨大的惊喜偶尔为之要更有助于男女关系! 生活中大多是些琐碎而重复的小事,从这些小事...
    Anejohn_liu阅读 585评论 0 1