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
After initialization warehouse, we can use git status
to 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
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 directory
mistake, 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
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,
Fifth, add a remote repository
- SSH warehouse obtained from the remote repository, enter the code cloud, click on cloning in the warehouse will be able to get SSH
- Use
git remote add origin [email protected]:xm99/mmall_learning.git
the command add a remote repository, that period is behind SSH warehouse
Sixth, the contents of the local branch of pushed to the remote repository
- First we look at the current use of which branch
git branch
- The branch pushed to the remote repository
git push -u origin master
, 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 pull
the 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