"Git" Intellij idea in git plugin submission content to remote repository

Source: Internet
Author: User
Tags port number using git git shell

First of all, thank you for your support. Some of the content of this blog show the format of a terrible, deliberately adjusted, I hope to be helpful to everyone.


Git has been used for a while in a standalone environment and found that the Git plugin in IntelliJ idea is not perfect. First, the Git local repository in IntelliJ idea must be built under the current project folder, and other custom locations are not supported.

Second, you can't use IntelliJ idea's git plugin to upload content from the local repository to the remote repository, and you'll need to use the GIT command line to do this (if your operating system is Linux using Git Bash, A command line window (CMD) Action command is used in Windows).


Here's a brief explanation of how to build a local git repository to import the source code and upload it to a remote git repository

1. Use the IntelliJ Idea menu to build a local Git repository: VCS, Import into Version Control-to create Git Repository;
2, select the current project in the popup window; 
  3, submit all the files that need to be managed to the newly established local repository Master branch,
4. Open the Command Line window cmd in Windows, and go to the directory where the current project is located, for example: CD "D:\projects\TestProject" (Assuming the current project name is TestProject);
Note: Before you do this, you must set the PATH environment variable so that the git executable can access it,
such as: path=%path%;D: \git\git-1.8.1.2\bin
5. Enter command at command line: Git remote Add origin HTTP//<IP Address: Port number >/Server relative path/warehouse name
6, re-enter command: Git push origin master
7, Then go back to the IntelliJ idea Environment, right-click on the project, select Synchronize Current Project menu: Synchronize ' TestProject ';
8, re-operate IntelliJ idea, right-click on the project to select git related actions: git- -Repository---Branches-origin/master-->checkout as new local branch



You can then use IntelliJ Idea's git plug-in to Pull/push the code in the local and remote repositories.
First of all, we've got a project under development, and now we're going to share it with Git@osc.


1. The first step, of course, is to create the warehouse on Git@osc and get the HTTP connection to the Git@osc warehouse Http://git.oschina.net/***/***.git

2. If our local project is a non-GIT project, we'll start by turning it into a git project
Vcs--import into Version control--create git repository--Select your local project in IntelliJ

3. Through the Git shell (you can install git for window) go to the project directory to execute the following command

# set remote remote repository for project #
Git remote add Origin Http://git.oschi Na.net/***/***.git
# Crawl Remote repository data and automatically merge remote branches #
Git pull Origin master 
# Update Local data to Git@osc #
Git push origin Master


Someone recently reflected the reason why you can't push, plus the following code is OK
can also command settings to track remote and local libraries
git branch--set-upstream master origin/ Master

If pull or push fails, refer to the GIT prompt for resolution   such as already have remote address can git remote RM origin clear

So the project is submitted to Git@osc, Later local modifications to the repository can be used to directly use idea for a unified push operation




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.