ubuntu builds a local warehouse and uploads it to gitee

1. Create a new project directory or cd to the directory to be uploaded.

2. Use the command to make the folder a local warehouse:

git init

3. Create and get the warehouse address of gitee, ending with .git, and then use the following command to bind:

git remote add origin 你的仓库git地址

If an error is reported at this time, and the binding already exists, use the following command to unbind and then execute the previous command:

git remote rm origin

4. After the binding is completed, use the following statement to complete the warehouse upload:

git add .
git commit -m "file name"
git push origin master

Solution: git error error: failed to push some refs to'https://github.com/...

Problem description: The following error occurred when typing $ git push origin master in git bash to submit:

error: failed to push some refs to 'https://github.com/bluetata/

The cause of the problem: the remote library is inconsistent with the local library. There is also a hint in the hint to synchronize the remote library to the local library.

Solution: Use the command line:

git pull --rebase origin master

This command means to merge the updates in the remote library into (pull=fetch+merge) the local library. The function of ---rebase is to cancel the commit just now in the local library and connect them to the updated version library. in. After the pull execution is successful as shown in the figure below, you can successfully execute the git push origin master operation.

In addition, all operations to upload local files are recorded.

If you want to delete a file in the warehouse, you can use the following statement:

git rm -r --cache 目录/文件名
git commit -r --cache "操作注释"

The directory and file name are for the warehouse path.
The above operation is deleted in the local warehouse, and then the push command is used to synchronize to the remote end.

How to check which files are in the local warehouse?

git ls-files

How to view files that have not been placed in the local warehouse?

git status

Guess you like

Origin blog.csdn.net/weixin_45146520/article/details/109008282