当前位置:   article > 正文

Github上传大于100M的文件(ubuntu教程)

Github上传大于100M的文件(ubuntu教程)

安装Git-lfs

Git Large File Storage (LFS) 使用 Git 内部的文本指针替换音频样本、视频、数据集和图形等大文件,同时将文件内容存储在 GitHub.com 或 GitHub Enterprise 等远程服务器上。官网下载:https://git-lfs.github.com/

在这里插入图片描述

./install.sh
  • 1

在这里插入图片描述

上传

比如我们要上传这个strace.txt

在这里插入图片描述

1.mkdir && cp

mkdir -p /opt/git-darshan-script
cd /opt/git-darshan-script
cp /xx/storage_strace.txt .
  • 1
  • 2
  • 3

2.git init

git init
  • 1

在这里插入图片描述

3.git-lfs install

git-lfs install
  • 1

在这里插入图片描述

问题:git:‘lfs’ 不是一个 git 命令。参见 ‘git --help’

参见前面安装Git-lfs。

在这里插入图片描述

4.git-lfs track “*.txt”

跟踪大文件:使用以下命令告诉 Git LFS 跟踪特定文件类型的大文件:

git-lfs track "*.txt"
  • 1

在这里插入图片描述

5.git add && git commit

添加和提交大文件:使用常规的 Git 命令 git add 和 git commit 将大文件添加到 Git LFS 管理中。

git add .
git add .gitattributes
git commit -m "darshan-script"
  • 1
  • 2
  • 3

.gitattributes 文件可以用于定义 Git 在处理文件时的行为,主要包括以下几方面:

  • 行结束符转换:指定在提交和检出文件时的行结束符转换规则。
  • 处理二进制文件:告诉 Git 某些文件是二进制文件,以避免对它们进行文本合并或转换。
  • 合并策略:为特定文件类型或文件设置自定义的合并策略。
  • 文件过滤:应用自定义的过滤器来处理文件内容,例如加密或压缩。

问题:作者身份未知*** 请告诉我您是谁。

作者身份未知*** 请告诉我您是谁。运行

git config --global user.email "you@example.com"
git config --global user.name "Your Name"
  • 1
  • 2

来设置您账号的缺省身份标识。如果仅在本仓库设置身份标识,则省略 --global 参数。

在这里插入图片描述

git config --global user.email "fakerth1001@163.com"
git config --global user.name "fakerth"
  • 1
  • 2

在这里插入图片描述

6.git remote add

将本地与新建仓库进行配对

git remote add origin git@github.com:fakerst/darshan-script.git
  • 1

7.git pull

git pull --rebase origin main
  • 1

在这里插入图片描述

问题:fatal: 无法读取远程仓库。请确认您有正确的访问权限并且仓库存在。

Warning: Permanently added ‘github.com’ (ED25519) to the list of known hosts.git@github.com: Permission denied (publickey).
fatal: 无法读取远程仓库。

请确认您有正确的访问权限并且仓库存在。

在这里插入图片描述

配置公钥和私钥:

ssh-keygen -t rsa -b 4096 -C "fakerth1001@163.com"
  • 1

在这里插入图片描述
添加私钥:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
  • 1
  • 2

添加公钥:

cat ~/.ssh/id_rsa.pub
  • 1

将公钥复制在github上添加。

在这里插入图片描述

问题:fatal: 无法找到远程引用 master

fatal: 无法找到远程引用 master,使用下面命令查看分支:

git remote show origin
  • 1

在这里插入图片描述
分支名为main,变基为mastar。

8.git push

git push origin master
  • 1

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/爱喝兽奶帝天荒/article/detail/763372
推荐阅读
相关标签
  

闽ICP备14008679号