1. Create a new repository remotely;
2. Open the command line and enter the project directory to initialize the local warehouse
git init
3. Associate remote warehouses and local warehouses
git remote add origin http://gogs.xxx.com.cn/xxx/enterprise.git
Fourth, add the project to the staging area
git add .
Five, submit the project
git commit -m "xxx rewrite project first commit"
Six, push to the remote
git push origin master
An error is reported at this time:
To http://gogs.xxx.com.cn/xxx/enterprise.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'http://gogs.xxx.com.cn/xxx/enterprise.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
There is a difference between the local version and the trunk. In this case, the conflict must be resolved first:
git pull --rebase origin master
Perform the sixth step again successfully.