When git uploads a project, it keeps reporting a file without adding any content (git pulls up other people’s projects and uploads them to their own warehouse/error: failed to push some refs to https://gitee.com/)

Blog homepage: Breaking the waves and moving forward
Series of columns: Vue, React, PHP
Thank you everyone for likingfavorites?comments

Table of Contents

Two methods:

1: Forced upload can be used

2: Delete other people’s .git files, because someone else has configured the remote address of git, and if you pull it locally together, he does not have the upload permission.

Check your files first

then delete

2. Upload local projects to your own Git repository (quick step-by-step breakdown):

Open our project. There is no .git file in the project at this time. In your project folder, [right-click the mouse] to pop up the menu. In the menu that pops up [right-click the mouse], click [Git Bash Here] in the command window. enter:

In the command window, enter: git remote add origin Your warehouse address in the command window: git pull origin master In the command window, enter: git add. In the command window, enter: git commit -m “Submit project” in the command window Enter: git push origin master. Now you can go to your Gitee warehouse, refresh it, and the local project will be uploaded to your own Git warehouse.

3. Solve the problem that the git warehouse update is rejected when uploading and an error is reported saying that the master is not suitable for use.

Solution:

Another method; refer to the following URL: https://blog.csdn.net/weixin_44322399/article/details/104297037?ops_request_misc= & amp;request_id= & amp;biz_id=102 & amp;utm_term=git warehouse update rejected & amp;utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-0-104297037.nonecase & amp;spm=1018.2226.3001.4187

Reference article: How to upload local projects cloned from other people’s git to your own Git repository. _Save other people’s github projects to yourself_Lidi Taisui Jiuwen Longer’s blog-CSDN blog


Two methods:

1: Forced upload
Can be used

git push -f

Command to force push

Pull the latest code: Before pushing, execute the git pull command to pull the latest code from the remote warehouse to the local warehouse, merge possible conflicts, and then try to push again.
Force push: If you are sure that the local code is correct and you want to overwrite the changes in the remote warehouse, you can use the git push -f command to force push. But please note that this may cause the history of the remote warehouse to be lost, so use it with caution.

Resolve conflicts: If conflicts occur, they need to be resolved manually. You can use the git status command to see which files have conflicts, then open these files for editing, fix the conflicts and save them. Then execute git add to add the modified file to the temporary storage area, and finally use git commit to submit the modification.

Check permissions: Make sure you have permission to push to the remote repository. Some warehouses may have permission controls set up, and you need to apply for relevant permissions from the administrator.

2: Delete other people’s .git files, Because someone else has configured the remote address of git, if you pull it locally together, he will not have upload permission

View your own files first

Then delete

rm -rf .git //Delete all .git files

If there is no .git file, perform the following operations

2. Upload local projects to your own Git repository
Quick step-by-step breakdown):

git init

In Gitee, in the newly created warehouse we just created, copy the address of the warehouse

Input in the command window: git remote add origin your Warehouse Address
Enter in the command window: git pull origin master
In the command window, enter: git add .
Enter in the command window: git commit -m “submit project”
Enter in the command window: git push origin master
Now you can go to your Gitee repository, refresh it, and upload the local project to your own Git repository.

If you modify the code later and want to submit it to the warehouse again, just perform steps 3, 4, and 5.

3. Solve the problem that the git warehouse update is rejected when uploading and report an error saying that master is not suitable for use.

When entering the command git push origin master to update the commit, the git bash window prompts that the update was rejected, indicating that the latest commit of the current branch lags behind its corresponding remote branch. As shown below:

Solution:

Force update via + master

git push -u origin + master

The warehouse will display:

Another method; refer to the following URL: https://blog.csdn.net/weixin_44322399/article/details/104297037?ops_request_misc= & amp;request_id= & amp;biz_id= 102 &utm_term=git warehouse update rejected&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-0-104297037.nonecase &spm=1018.2226.3001.4187

Reference article: How to upload local projects cloned from other people’s git to your own Git repository. _Save other people’s github projects to yourself_Lidi Taisui Jiuwen Longer’s blog-CSDN blog

To prevent being banned by mistake, this statement is added:
Copyright statement: This article is an original article by the CSDN blogger “Li Di Tai Sui Jiu Wen Long Er” and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement when reprinting.
Original link: https://blog.csdn.net/weixin_46921165/article/details/129971486