Intellij idea uploading a local project to Git

Source: Internet
Author: User
Tags port number using git git shell
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. Using the IntelliJ Idea menu to build a local Git repository: VCS, Import into Version Control-and 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, 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 commands on the 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 and right-click on the project and choose the Sync Current Project menu: Synchronize ' TestProject '; 8, again operation IntelliJ Idea, right-click on the project to choose git related actions: git, Repository, Branches, Origin/master, Checkout as New L Ocal Branch.

You can then use IntelliJ Idea's git plugin to pull/push the code in the local and remote repositories.

First of all, the situation we have solved is that we have a project under development and now we want to share it with Git@osc.

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

2. If our local project is a non-GIT project, then we need to turn it into a git project first.
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

[plain] view plain copy print? # Set remote remote repository to project # git remote add Origin http://git.oschina.net/***/***.git # Crawl remote repository data and Automatically merge remote branch # Git pull Origin mast ER # Update local data to Git@osc # Git push Origin Master

Recently, some people reflect the reasons for not push, plus the following code is OK

You can also command settings to track remote libraries and local libraries

Git branch--set-upstream Master origin/master
?

If pull or push fails, refer to the GIT prompt for a workaround such as a remote address can be git remote rm origin cleanup

This project will be submitted to the Git@osc, and later local changes submitted to the warehouse can be directly using idea for unified push operation


This article is reproduced in http://blog.csdn.net/jabony/article/details/45562445

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.