idea git operations - has been added to the git project

When we use git, if the project is to start with git clone, and then configure the program to run no problem, if you add an existing project to git, the git project environment still can not submit, also you need to clone the repository folder to open the project to operate git, if there are types of cases may be provided to the following procedure.

IDEA project submitted to Git

  1. Git installed on the local machine
  2. IDEA configure the local git: File -> Seetings, Path to Git executable select local git address

     

     

  3. Click Test, under the plans indicate if there is a local git configuration is successful


  4. Create a local git repository, select the local project directory
    VSC -> Import into Version Control - > Create Git Repositor

     

     

  5. Add items to your local git, found in the project directory Mail git -> add

     

     

  6. Add If you need to reset the following error git repository directory, and perform step 4 again

     

     Click Configure to open Seetings page, add new Version Conrol directory

     

     After the configuration step 4 again

  7. Commit the code to a local git repository
    on a project right Git -> Commit Changes, fill comments submitted to the local git repository

     

     

  8. Push project to git
    on the project right Git -> Repository -> Push

     

     First you need to configure git push information, click Define remote, remote git configuration information, enter the remote git repository address, and authorized, with the username token or
    click Push, first push will complain, suggesting rejected

     

     这是因为git 认为本地仓库和服务器仓库不一致,怕提交错误,只需要执行下面命令允许提交即可,如果是服务器上先创建的项目clone到本地的不会有次问题
    git pull origin master --allow-unrelated-histories
    注意git pull后面的两个参数为配置过程中你所配置的信息,如果默认配置则不用改
    可再idea的Terminal中执行,在执行之前一定需要完成以上步骤配置远程git信息

     

     

  9. 执行完成之后再次push 即可提交成功

 

Guess you like

Origin www.cnblogs.com/binw/p/12028703.html
Recommended