Today, the leader created a new git warehouse for me, and a file readme. MD
already exists in the GIT warehouse. As usual, I operate locally as follows:
git init //Initialize the repository
git add . (file name) //add the file to the local repository
git commit -m "first commit" //add file description information
git remote add origin + remote repository address //link the remote repository and create a master branch
git push -u origin master //Push files from the local repository to the remote repository
But tip:
Reason: readme.md already exists in the new git warehouse, but the files of the local warehouse and the remote warehouse have not been associated. Therefore, we first associate the files of the two warehouses and then submit them
enter the commands in the terminl window of idea
git pull
git pull origin master
git pull origin master --allow-unrelated-histories
Then push the project again to succeed
if you still report an error, you can delete the local. Git folder and re associate the file:
git init //Initialize the repository
git add . (file name) //add the file to the local repository
git commit -m "first commit" //add file description information
git remote add origin + remote repository address //link remote repository, create master branch
#Associate files
git pull
git pull origin master
git pull origin master --allow-unrelated-histories
#push the code to the remote branch
git push -u origin master //Push files from the local repository to the remote repository
Read More:
- Solve git upload file error [rejected] master -> master (fetch first) error: failed to push some refs to ‘
- [Solved] Git push error: failed to push some refs to ‘[email protected]:daisy_yangyang/fed-e-task-04-01.git‘
- The request was rejected because the URL contained a potentially malicious String “//“
- How to Solve gtid master-slave replication connecting Issue
- Initializing the Kubernetes master node ERROR: failed to pull image registry.aliyuncs.com/google_containers/coredns:v1.8.0
- [Git] Solve git branch -M main error: refname refs/heads/master not found
- [Nginx] Solve the problem of being blocked by CORS policy: No’Access-Control-Allow-Origin’ header is present on the requested resource.
- [Solved] Dvc push Error: (ERROR: configuration error…)
- [Solved] rs_to_velodyne-master compile Error: POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature
- [Solved] Git Error: OpenSSL SSL_read: Connection was reset, errno 10054和Failed to connect to github.com port 443
- [How to Solve] Git Push stuck in ‘writing objects’
- Git Push Error: error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
- [Solved] Web server failed to start. Port 8080 was already in use.
- [Solved] ERROR: The kernel module failed to load, because it was not signed by a key that is trusted by the
- [Solved] Flask Error: RuntimeError: The session is unavailable because no secret key was set.
- [Solved] gnutls_handshake() failed: The TLS connection was non-properly terminated
- [Solved] error: ‘QStringLiteral’ was not declared in this scope
- [Solved] dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
- [Solved] vs Error: VS_error MSB4044, the required parameter ‘RemoteTarget’ of the task ‘ValidateValidArchitecture’ was not assigned a value
- [Solved] error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.