boxmoe_header_banner_img

⋅無⋅限⋅進⋅步⋅

加载中

文章导读

Git推送至Github


avatar
yuhui 2025年10月17日 47

Git推送至Github

1、安装git

2、打开git bash

3、更改本地库为main(这里看需求,要与远程库名一致)

git branch -m master main

1744350167135-2958682f-0f44-4812-811f-f342b53f9014.png

4、创建上传文件的文件夹

mkdir upload

cd upload

1744350182388-1882c61c-4673-4b89-b523-9345e6600d8e.png

5、创建本地仓库环境

git init

1744350187929-3df99af0-a244-4d88-9f92-0e30de22db16.png

6、安装大文件上传

git lfs install

1744350194800-c5cc6681-5cc7-4b18-8927-6f07f8b42f05.png

7、追踪要上传的大文件,*表示路径下的所有文件

<font style="color:rgb(77, 77, 77);">git lfs track *</font>

1744350201213-90c1c54d-f998-49e6-9d17-312f758b65c8.png

8、添加先上传的属性文件(要先上传属性文件,不然有可能失败)

<font style="color:rgb(77, 77, 77);">git add .gitattributes</font>

1744350211556-231d7109-0aa3-4868-b9ff-66dd4d92a418.png

9、添加属性文件上传的说明

<font style="color:rgb(77, 77, 77);">git commit -m "pre"</font>

1744350217314-7ceee7fc-d168-4849-bb96-aeac1fb81f5a.png

10、建立本地和 Github 仓库的链接(origin 后接自己仓库的链接)

<font style="color:rgb(77, 77, 77);">git remote add origin </font>[https://github.com/YVHU1/YH-ToDo.git](https://github.com/YVHU1/YH-ToDo.git)

11、上传属性文件

<font style="color:rgb(77, 77, 77);">git push origin master</font>

12、添加要上传的大文件,*表示路径下的所有文件

<font style="color:rgb(77, 77, 77);">git add *</font>

1744350224052-cac6a995-fbea-4636-89b1-952168cce4b0.png

13、添加大文件上传的说明

<font style="color:rgb(77, 77, 77);">git commit -m "Git LFS commit"</font>

1744350233606-eb24c6cc-1cba-4888-8c8a-f92454dff061.png

14、上传大文件

<font style="color:rgb(77, 77, 77);">git push origin master</font>

这里会打开一个弹窗要求认证,在认证结束后即可重新上传文件

1744350269312-2444123b-e904-41d1-9556-c7ef4575252e.png

15、查看远程库和本地库

git branch -a

1744350299267-2203275e-2a52-4815-9262-ead8184fefa9.png

16、强制整合远程库

1744350338289-fb54e6af-39a7-4316-824b-f9223dde1f29.png

更新: 2025-04-11 14:09:21
原文: https://www.yuque.com/yuhui.net/miao/qubgvtm3n41hostg



评论(0)

查看评论列表

暂无评论


发表评论

表情 颜文字

插入代码