The IDEA project created directly pushed to the cloud code

Disclaimer: This article is a blogger original article, reproduced, please attach Bowen link! https://blog.csdn.net/f2764052703/article/details/90606856

First, create a project using IDEA

Here is a Maven project I created

Second, the project will be initialized to the git repository

In the directory where the project is open Git Bash Here, enter git init, enter, you can initialize the directory into a git repository
Initialization warehouse

After initialization warehouse, we can use git statusto see the warehouse if initialization succeeds, and you can see what files have not add

Third, the file modification added to the staging area

Use git add .the command
error
where there is a warning: LF will be replaced by CRLF in src/main/webapp/WEB-INF/web.xml. The file will have its original line endings in your working directorymistake, the wrong way to solve sequentially execute the following two commands:

  • git rm -r --cached .
  • git config core.autocrlf false

After re-use the git add .command to upload the file, normal
Resolve error

Fourth, all the contents submitted to the staging area of ​​the current branch

Use git commit -am "XXXXXXX"the submission temporary area to the branch,
Submitted to the branch

Fifth, add a remote repository

  1. SSH warehouse obtained from the remote repository, enter the code cloud, click on cloning in the warehouse will be able to get SSH
  2. Use git remote add origin [email protected]:xm99/mmall_learning.gitthe command add a remote repository, that period is behind SSH warehouse
    Adding a remote repository

Sixth, the contents of the local branch of pushed to the remote repository

  1. First we look at the current use of which branch
    git branch
    View branch
  2. The branch pushed to the remote repository
    git push -u origin master
    The local branch can not be pushed to the remote
    , but here there is a mistake: failed to push some refs to '[email protected]:xm99/mmall_learning.git'
    said to be unable to push content to a remote repository

There is no reason to synchronize the remote repository, so we need to execute git pullthe contents of the update to the local remote repository before you can push past

More program: error when submitting git: Updates were rejected because the tip of your current branch is behind Anrik_gwp

Guess you like

Origin blog.csdn.net/f2764052703/article/details/90606856