How to submit code to a remote Github repository at Intellij idea

Source: Internet
Author: User
Tags commit git clone
[Intellij IDEA submit code to remote GitHub repository] (https://my.oschina.net/lujianing/blog/180728)-[Git study notes and IntelliJ IDEA integration] (http://www.cnblogs.com/MrJun /p/3351478.html) —
A. Git study notes (based on Github)
1. Install and configure Git
Download address: http://git-scm.com/downloads
 Git brief instructions: http://rogerdudler.github.io/git-guide/index.zh.html
 Github official instructions: https://help.github.com/articles/set-up-git
Default installation
Configuration
1) First you have to tell git your name
Git config –global user.name “Your Name Here”
2) Associated Email Address:
Git config –global user.email “your_email@example.com”
The associated email address is best consistent with github, if not, click here: https://help.github.com/articles/how-do-i-change-my-primary-email-address
 
2. Create a warehouse
1) Create a repository on Github (registration omitted)

2) Fill in the warehouse information; Example: Hello-World

Congratulations! You have successfully created your first warehouse.
 
3. Create a README for the repository.
README is not a necessary part on GitHub, but it is a very good idea. It can describe your project or some documents, such as how to install or use your project.
 
$ Mkdir ~ / Hello-World
# Create a Hello-World folder in your directory
 $ Cd ~ / Hello-World
# Change the current working directory to your newly created directory
 
$ Git init
# Initialize /Users/you/Hello-World/.git/
 
$ Touch README
# Create a file called "README" in your hello world directory
进入 Enter Hello-World in the user directory of the C drive, open the README, and fill in what you want to fill in
 
4. Submit your "README"
 
$ Git add README
# Add README to the submission list
 
$ Git commit -m ‘first commit’
# Submit your file, add the message "First commit"
 
5. Push your submission to the GitHub server
$ Git remote add origin https://github.com/username/Hello-World.git
# Create a remote named "origin" pointing to your GitHub repository; username: for your github username
Hello-World This is case sensitive and it's important to stay the same with the server
$ git push origin master
#Send your commit to the "master" branch to GitHub
You will be asked to enter your username and password
 
OK! At this time, the README you submitted can be seen on Hello-World on the server.
 
6. Create branch
At some point you may find yourself wanting to work on someone else's project, or want to use someone else's project as a starting point.
This is the so-called "branch". For this tutorial, we will use the Spoon-Knife project, hosted on GitHub.com.
 
1) Create "Spoon-Knife" branch
Create a branch project and click the "Fork" button in the GitHub repository.

 
2) clone branch
You have successfully branched "Spoon-Knife", but so far it only exists on GitHub. To be able to work on this project, you will need to clone it to your local machine.
 
$ Git clone https://github.com/username/Spoon-Knife.git
# Clone your branch's repository to the current directory
3) Configure remote
When a repository is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repository is a branch, to track the original repository, you need to add another remote named upstream
 
$ Cd Spoon-Knife
# Change the active directory and enter the "Spoon-Knife" directory
$ git remote add upstream https://github.com/octocat/Spoon-Knife.git
# Assign the original library remote name as "upstream"
$ git fetch upstream
# Pulls in changes not present in your local repository, without modifying your files
 
 
2. Use IntelliJ IDEA to share and get Github projects:
· 1. Configure Git in IDEA:
· Select the menu “File — Settings” and find “Version Control — Git”: Go to the location of the Git.exe executable file in the Git installation directory
·
 
Secondly, configure your account registered on Github:
Fill in your Github account information and click the "Test" button to test the connection. If the link is successful, it will prompt "Connection successful". Save is complete.
Click OK, you may be asked to enter the IntelliJ IDEA password at this time. If it is not set, click OK.

 
2. Share project on Github:
Select the menu "VCS — Import into Version Control — Share project on Github":

 
After filling in the description information, click the "Share" button.
 
3. Get Github project:
Select menu “VCS — Checkout from Version Control — Github”:

 
Wait for a while to verify and log in, the interface appears:

In the "Git Repository URL" list, there are both your own project and your "Wacth" project on the Github website. After selecting, select the path where you stored it, then enter the name of the project you want, and click "Clone" Button to complete the acquisition process.

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.