Git命令行

### cmd

```

echo "# test" >> README.md

git init

git add README.md

git commit -m "first commit"

git branch -M main

git remote add origin https://github.com/ev11ccaatt/test.git

git push -u origin main

```

这是新仓库的setup

在执行完git init 后,所在位置的文件夹就会成为本地仓库

那么来进行第一次推送

```

git add FILENAME

git commit -m "message" (filename) 可选,默认全部

git push

```

可以通过git status 来查看状态

[Git - git-status Documentation (git-scm.com)](https://git-scm.com/docs/git-status/zh_HANS-CN)

然后会有一定的报错比如

```

error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)

解决方法:git config --global http.version HTTP/1.1

```

然后还有最主要的文件大小限制,当大于50mb就会进行waring,大于100mb就会出现错误,无法上传

网传可以通过修改

```

git config --global http.postBuffer 524288000

```

来上传大文件

但我这里并不行

于是使用lfs来进行上传

下载地址[Git Large File Storage | Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.](https://git-lfs.github.com./)

记得这是在正常push之后即将小于100mb的文件push上去后

```

git lsf track FILENAME 对大文件进行追踪

git add FILENAME (FILENAME中可以包含路径

git commit

git push

```

[Git LFS 操作指南 - Gitee.com](https://gitee.com/help/articles/4235#article-header8)


 

你可能感兴趣的:(git,github)