Git uploads files to Gitee and reports "error: failed to push some refs to https://gitee.com/xxxx"


foreword

I want to upload a 4.27 GB file to Gitee, but the following error occurs,
error: failed to push some refs to 'https://gitee.com/xxxx/centos.git
so I will record the method to solve the error.


1. Create a project warehouse

To create a new project warehouse, you can refer to my previous blog Pycharm integration and use of Gitee . I created a new warehouse named Centos here.

2. Create a workspace

1. Create a new local folder named Centos
insert image description here
2. Enter the Centos directory, right-click and select Git Bash Here
insert image description here
3. Initialize the local library

git init

insert image description here

3. Configure LFS

1. Open LFS
In the previous blog, I have talked about the download and installation of Git-LFS. Please refer to the error remote: error: this exceeds GitHub's file size limit of 100.00 MB when using git push to upload files exceeding 100MB

git lfs install

2. Move the CentOS-7-x86_64-DVD-1810.iso file to the current directory and execute
insert image description here

git lfs track CentOS-7-x86_64-DVD-1810.iso

3. Track large files that need to be uploaded

 git lfs track CentOS-7-x86_64-DVD-1810.iso

4. Add the file attributes to be uploaded, (you must add the file attributes first, otherwise it may fail)

git add .gitattributes

5. Add description of attribute file upload

git commit -m "pre"

6. Establish a link between the local and Gitee warehouses (alias)

git remote add origin https://gitee.com/liupeng97/centos.git

7. Upload property file

git push [email protected]:liupeng97/centos.git master

insert image description here
Reason for error:

No SSH public key git generated

Solution:

Refer to my previous blog Github SSH password-free login

After configuring the SSH public key, upload the property file again to succeed.
insert image description here
There is also an uploaded property file in Gitee's project warehouse
insert image description here

4. Upload the image file

1. Add the Centos image file to be uploaded

git add -f CentOS-7-x86_64-DVD-1810.iso

2. Add the description of the Centos image file to be uploaded

git commit -m " CentOS-7-x86_64-DVD-1810.iso"

insert image description here
3. Upload the Centos image file

git push origin master

insert image description here
There are two main error messages here:

WARNING: Authentication error: Authentication required: LFS only supported repository in paid enterprise.

batch response: LFS only supported repository in paid enterprise.

Solution:
①. Solution to the first error:

git config lfs.https://gitee.com/{
    
    your_gitee}/{
    
    your_repo}.git/info/lfs.locksverify false

{your_gitee}/{your_repo} in the command is your remote warehouse address, replace it according to your own situation.
Take mine as an example

git config lfs.https://gitee.com/xxxx/centos.git/info/lfs.locksverify false

②, the second error solution:
delete the ./git/hooks/pre-push file

rm .git/hooks/pre-push

insert image description here
Upload the Centos image file again

git push origin master

insert image description here

It has been successful, and then go to the Gitee project warehouse to have a look
insert image description here


My qq: 2442391036, welcome to communicate!


Guess you like

Origin blog.csdn.net/qq_41839588/article/details/131566369