Upload the project to GitHub and synchronize the remote Github Repository

Source: Internet
Author: User
Tags using git

Upload the project to GitHub and synchronize the remote Github Repository

Recently I was writing a simple Android project. However, due to loose personnel management, I decided to submit the code to GitHub and feel GitHub, which has been very popular.

Overview:

1. I wanted to be lazy and see if there are any open-source tools for teams that are similar to subversion and simple operations. However, I used them in the Java Web field before. Of course I used the appropriate tools in mobile development, so discard it

2. Another thought is that there is no eclipse plug-in, integrated upload, and download the source code on github? Reference (use GitHub to manage Eclipse distributed project development), but it is not very detailed, because my eclipse is the latest version of google, an error will be reported when installing the plug-in, in addition, the startup interface will change, and it took two hours, but there is still no clue, and I will give up again.

3. At last, I thought about it. What is the process I want?

Upload local code-> github website

Others from the team

Submit the changes later.

So google,

Refer to the following articles:

Share and present your code on GitHub

Git/Github usage notes

The code below is just a record. If you are interested, you can take a look at it. It's a short time. I hope you can talk more and learn about it on github!

Welcome to Git (version 1.8.3-preview20130601)


Run 'git help git 'to display the help index.
Run 'git help <command> 'to display help for specific commands.

Administrator @ VAIO-11061700/d/GitHub/RescueApp
$ Git config -- global user. name "jptiancai"

Administrator @ VAIO-11061700/d/GitHub/RescueApp
$ Git config -- global user. email mail_jzy@163.com

Administrator @ VAIO-11061700/d/GitHub/RescueApp
$ Ssh-keygen-C 'mail _ jzy@163.com '-t rsa

Administrator @ VAIO-11061700/d/GitHub/RescueApp
$ Ssh-keygen-C 'mail _ jzy@163.com '-t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Documents and Settings/Administrator/. ss
H/id_rsa ):
/C/Documents and Settings/Administrator/. ssh/id_rsa already exists.
Overwrite (y/n )? Y
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in/c/Documents ents and Settings/Administrator/. s
Sh/id_rsa.
Your public key has been saved in/c/Documents and Settings/Administrator/. ssh/I
D_rsa.pub.
The key fingerprint is:
9f: be: 0c: 2e: de: a5: 5f: 2b: 86: 3e: 73: 1d: 33: 71: 60: AB mail_jzy@163.com

Administrator @ VAIO-11061700/d/GitHub/RescueApp
$ Git init
Initialized empty Git repository in D:/GitHub/RescueApp/. git/

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git add.
Warning: LF will be replaced by CRLF in AndroidManifest. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in gen/com/yonvoo/main/BuildConfig. java.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in proguard-project.txt.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in project. properties.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values-v11/styles. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values-v14/styles. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values/strings. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values/styles. xml.
The file will have its original line endings in your working directory.

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git remote add origin git@github.com: jptiancai/RescueApp. git

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git push origin master
Fatal: cocould not read from remote repository.

Please make sure you have the correct access rights
And the repository exists.

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git push origin master
The authenticity of host 'github. com (204.232.175.90) 'can't be established.
RSA key fingerprint is 16: 27: ac: a5: 76: 28: 2d: 36: 63: 1b: 56: 4d: eb: df: a6: 48.
Are you sure you want to continue connecting (yes/no )? Y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github. com, 204.232.175.90 '(RSA) to the list of know
N hosts.
Error: src refspec master does not match any.
Error: failed to push some refs to 'git @ github.com: jptiancai/RescueApp. git'

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git push origin master
Error: src refspec master does not match any.
Error: failed to push some refs to 'git @ github.com: jptiancai/RescueApp. git'

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git commit-m'initial commit'
[Master (root-commit) 926da3f] initial commit
Warning: LF will be replaced by CRLF in AndroidManifest. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in gen/com/yonvoo/main/BuildConfig. java.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in proguard-project.txt.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in project. properties.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values-v11/styles. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values-v14/styles. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values/strings. xml.
The file will have its original line endings in your working directory.
Warning: LF will be replaced by CRLF in res/values/styles. xml.
The file will have its original line endings in your working directory.
74 files changed, 1548 insertions (+)
Create mode 100644. gitattributes
Create mode 100644. gitignore
Create mode 100644 AndroidManifest. xml
Create mode 100644 gen/com/yonvoo/main/BuildConfig. java
Create mode 100644 gen/com/yonvoo/main/R. java
Create mode 100644 ic_launcher-web.png
Create mode 100644 libs/android-support-v4.jar
Create mode 100644 proguard-project.txt
"Create mode 100644 project. properties"
Create mode 100644 res/drawable-hdpi/app_logo.png
Create mode 100644 res/drawable-hdpi/bg.png
Create mode 100644 res/drawable-hdpi/butten_pressed.png
Create mode 100644 res/drawable-hdpi/dark_dot.png
Create mode 100644 res/drawable-hdpi/guide_350_01.jpg
Create mode 100644 res/drawable-hdpi/guide_350_02.jpg
Create mode 100644 res/drawable-hdpi/guide_350_03.jpg
Create mode 100644 res/drawable-hdpi/guide_350_04.jpg
Create mode 100644 res/drawable-hdpi/ic_launcher.png
Create mode 100644 res/drawable-hdpi/item_bg.png
Create mode 100644 res/drawable-hdpi/photo8.png
Create mode 100644 res/drawable-hdpi/richangyiwai.png
Create mode 100644 res/drawable-hdpi/settings.png
Create mode 100644 res/drawable-hdpi/welcome.png
Create mode 100644 res/drawable-hdpi/welcome_android.jpg
Create mode 100644 res/drawable-hdpi/white_dot.png
Create mode 100644 res/drawable-hdpi/yundongzijiu.png
Create mode 100644 res/drawable-hdpi/ziranzaihai.png
Create mode 100644 res/drawable-ldpi/butten_pressed.png
Create mode 100644 res/drawable-ldpi/butten_unpress.png
Create mode 100644 res/drawable-ldpi/dark_dot.png
Create mode 100644 res/drawable-ldpi/guide_350_01.jpg
Create mode 100644 res/drawable-ldpi/guide_350_02.jpg
Create mode 100644 res/drawable-ldpi/guide_350_03.jpg
Create mode 100644 res/drawable-ldpi/guide_350_04.jpg
Create mode 100644 res/drawable-ldpi/ic_launcher.png
Create mode 100644 res/drawable-ldpi/logo.png
Create mode 100644 res/drawable-ldpi/welcome_android.jpg
Create mode 100644 res/drawable-ldpi/white_dot.png
Create mode 100644 res/drawable-mdpi/ic_launcher.png
Create mode 100644 res/drawable-xhdpi/ic_launcher.png
Create mode 100644 res/drawable/dot. xml
Create mode 100644 res/drawable/whats_new_start_btn.xml
Create mode 100644 res/layout/detail. xml
Create mode 100644 res/layout/griditem. xml
Create mode 100644 res/layout/guide. xml
Create mode 100644 res/layout/listview_item.xml
Create mode 100644 res/layout/main. xml
Create mode 100644 res/layout/splash. xml
Create mode 100644 res/layout/test. xml
Create mode 100644 res/layout/what_new_four.xml
Create mode 100644 res/layout/what_new_one.xml
Create mode 100644 res/layout/what_new_three.xml
Create mode 100644 res/layout/what_new_two.xml
Create mode 100644 res/menu/activity_main.xml
Create mode 100644 res/values-v11/styles. xml
Create mode 100644 res/values-v14/styles. xml
Create mode 100644 res/values/strings. xml
Create mode 100644 res/values/styles. xml
Create mode 100644 src/com/yonvoo/activity/DetailActivity. java
Create mode 100644 src/com/yonvoo/activity/GuideActivity. java
Create mode 100644 src/com/yonvoo/activity/MainActivity. java
Create mode 100644 src/com/yonvoo/activity/SecCategoryActivity. java
Create mode 100644 src/com/yonvoo/activity/SplashActivity. java
Create mode 100644 src/com/yonvoo/adapter/GridViewAdapter. java
Create mode 100644 src/com/yonvoo/adapter/ListViewAdapter. java
Create mode 100644 src/com/yonvoo/adapter/ViewPagerAdapter. java
Create mode 100644 src/com/yonvoo/domain/Category. java
Create mode 100644 src/com/yonvoo/domain/Detail. java
Create mode 100644 src/com/yonvoo/domain/SecCategory. java
Create mode 100644 src/com/yonvoo/service/CategoryService. java
Create mode 100644 src/com/yonvoo/service/DBHelper. java
Create mode 100644 src/com/yonvoo/service/DetailService. java
Create mode 100644 src/com/yonvoo/service/SecCategoryService. java
Create mode 100644 src/com/yonvoo/test/DBTest. java

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git push origin master
To git@github.com: jptiancai/RescueApp. git
! [Rejected] master-> master (fetch first)
Error: failed to push some refs to 'git @ github.com: jptiancai/RescueApp. git'
Hint: Updates were rejected because the remote contains work that you do
Hint: not have locally. This is usually caused by another repository pushing
Hint: to the same ref. You may be want to first merge the remote changes (e.g .,
Hint: 'git pull ') before pushing again.
Hint: See the 'note about fast-forwards 'in 'git push -- help' for details.

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$ Git push-f
Warning: push. default is unset; its implicit value is changing in
Git 2.0 from 'matching 'to 'simple'. To squelch this message
And maintain the current behavior after the default changes, use:

Git config -- global push. default matching

To squelch this message and adopt the new behavior now, use:

Git config -- global push. default simple

See 'git help config' and search for 'Push. default' for further information.
(The 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'Stream' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 92, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (81/81), done.
Writing objects: 100% (92/92), 2.20 MiB | 966.00 KiB/s, done.
Total 92 (delta 12), reused 0 (delta 0)
To git@github.com: jptiancai/RescueApp. git
+ Be58463. .. 926da3f master-> master (forced update)

Administrator @ VAIO-11061700/d/GitHub/RescueApp (master)
$

--------------------------------------------------- Subsequent updates --------------------------------------------------

After several days, the above Code is still useful when git is used again as a god-class version management tool. Here, I will summarize it for you to view it later:

Create a personal project on github or fork another project

 

      1. Configure the user name, password, and private key ---> to connect to github. If you need to set up proxy to access the Internet, please refer to this article: Set proxy in the company's LAN Using git or github [1]
      2. Add local files to the github code library ---> inti, add, remote add, commit, push. When the master is integrated into the master, you can use-f to force merge
      3. Git clone github address. You can copy and paste the address directly.

 

      • GitHub Guides [2]: there are currently only nine teaching articles, but the articles are classic. From HelloWorld, you will surely get some results.
      • Git official website [3]: the website is very friendly and provides online TryGit learning methods, documents, videos, and software.
      • Git cheatsheet [4]: it contains most of the commands, which are very practical!
Submit your own code, refer to Pushing to a remote [1]

Fork

Git branch new_branch
Git checkout new_branch
A series of operations (git add ......)
Git push origin new_branch

----------------

Refresh the official website and you will see it. Submit it and wait for the user to pass the review.

Submit your own code and synchronize the latest Code. For details, refer to [2] and [3].

Merge goes to the master of his project. After submission, it will be reviewed by the original author.
Git checkout master ---> run as a master
Git merge new_branch
Git diff new_branch master
Git status

Scenario: the original project (orgin) has been on the page fork a home page of its own project (master), there is also a working version (local, although you can see on the console is the master, but it should be understood in this way ). I recently saw many updates to the origin project. The first is update.

  • Git fetch xx (git address of the origin Project, which can be copied on the page): bash returns information * branch HEAD-> FETCH_HEAD
  • Git merge HEAD FETCH_HEAD: Follow the prompts to synchronize information between the local warehouse (local) and the original project (origin)
  • Git push: Submit the local project to your project master ).

References:

[1] Pushing to a remote
[2]. How to upload project contribution code on GitHub
[3]. on GitHub, how to fork a project to contribute code and synchronize modifications made by the original author?

GitHub Tutorials:

Create a personal technical blog via GitHub

GitHub tutorials

Git tag management details

Git branch management

Git remote repository details

Git local Repository (Repository) Details

Git server setup and Client installation

Git Overview

Share practical GitHub tutorials

GitHub details: click here
GitHub: click here

This article permanently updates the link address:

Related Article

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.