Using Github

I have been thinking about sharing XProject code to other team members. Currently, all individual projects are located locally on developers machine. I thought we could use GitHub to merge these projects later on.

There is a GitHub help online. It is very helpful to understand how GitHub works. So far, I grasp the basic concept of how GitHub works. When I tried first time, I made a mistake by naming Remote Repo different from my local Repo. I tried to rename Remote Repo to match my local, but Git Bash didn’t recognize the Remote Repo.

Below is the key command that displays after creating a Remote Repo.

Global setup:
Set up git
git config --global user.name "Michael Jo"
git config --global user.email michael.jo@gmail.com

Next steps:
mkdir Hello-World
cd Hello-World
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:demj33/Hello-World.git
git push -u origin master

Existing Git Repo?
cd existing_git_repo
git remote add origin git@github.com:demj33/Hello-World.git
git push -u origin master

Git Bash Command to Add, Commit, and Push source code to Remote Repo from Git Bash

(Source code was from IBM Richfaces Tutorial)

msjo@HY139275 ~/GitRepo
$ cd Hello-World

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ ls
README

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ git add .
warning: LF will be replaced by CRLF in JbossRich/JavaSource/City.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/JavaSource/dwRF4D1Handler.java
.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/WebContent/WEB-INF/faces-confi
g.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/WebContent/index.xhtml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/WebContent/result.xhtml.
The file will have its original line endings in your working directory.

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ git status -s
A JbossRich/.classpath
A JbossRich/.project
A JbossRich/.settings/.jsdtscope
A JbossRich/.settings/oracle.eclipse.tools.webtier.ui.prefs
A JbossRich/.settings/org.eclipse.jdt.core.prefs
A JbossRich/.settings/org.eclipse.wst.common.component
A JbossRich/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
A JbossRich/.settings/org.eclipse.wst.common.project.facet.core.xml
A JbossRich/.settings/org.eclipse.wst.jsdt.ui.superType.container
A JbossRich/.settings/org.eclipse.wst.jsdt.ui.superType.name
A JbossRich/JavaSource/City.java
A JbossRich/JavaSource/dwRF4D1Handler.java
A JbossRich/JavaSource/dwRF4Demo1.properties
A JbossRich/JavaSource/resources/application.properties
A JbossRich/WebContent/META-INF/MANIFEST.MF
A JbossRich/WebContent/WEB-INF/classes/City.class
A JbossRich/WebContent/WEB-INF/classes/dwRF4D1Handler.class
A JbossRich/WebContent/WEB-INF/classes/dwRF4Demo1.properties
A JbossRich/WebContent/WEB-INF/classes/resources/application.properties
A JbossRich/WebContent/WEB-INF/faces-config.xml
A JbossRich/WebContent/WEB-INF/lib/cssparser-0.9.5.jar
A JbossRich/WebContent/WEB-INF/lib/guava-11.0.2.jar
A JbossRich/WebContent/WEB-INF/lib/richfaces-components-api-4.2.0.Final.jar
A JbossRich/WebContent/WEB-INF/lib/richfaces-components-ui-4.2.0.Final.jar
A JbossRich/WebContent/WEB-INF/lib/richfaces-core-api-4.2.0.Final.jar
A JbossRich/WebContent/WEB-INF/lib/richfaces-core-impl-4.2.0.Final.jar
A JbossRich/WebContent/WEB-INF/lib/sac-1.3.jar
A JbossRich/WebContent/WEB-INF/web.xml
A JbossRich/WebContent/css/default.css
A JbossRich/WebContent/images/DukeGuitar.jpg
A JbossRich/WebContent/images/myphoto.jpg
A JbossRich/WebContent/images/roseTab.jpg
A JbossRich/WebContent/index.xhtml
A JbossRich/WebContent/result.xhtml
A JbossRich/ant/build.properties

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ git config --global user.name "Michael Jo"

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ git config --global user.email michael.jo@gmail.com

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ git commit -m "initially added"
[master 3eae909] initially added
warning: LF will be replaced by CRLF in JbossRich/JavaSource/City.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/JavaSource/dwRF4D1Handler.java
.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/WebContent/WEB-INF/faces-confi
g.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/WebContent/index.xhtml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in JbossRich/WebContent/result.xhtml.
The file will have its original line endings in your working directory.
35 files changed, 647 insertions(+)
create mode 100644 JbossRich/.classpath
create mode 100644 JbossRich/.project
create mode 100644 JbossRich/.settings/.jsdtscope
create mode 100644 JbossRich/.settings/oracle.eclipse.tools.webtier.ui.prefs
create mode 100644 JbossRich/.settings/org.eclipse.jdt.core.prefs
create mode 100644 JbossRich/.settings/org.eclipse.wst.common.component
create mode 100644 JbossRich/.settings/org.eclipse.wst.common.project.facet.cor
e.prefs.xml
create mode 100644 JbossRich/.settings/org.eclipse.wst.common.project.facet.cor
e.xml
create mode 100644 JbossRich/.settings/org.eclipse.wst.jsdt.ui.superType.contai
ner
create mode 100644 JbossRich/.settings/org.eclipse.wst.jsdt.ui.superType.name
create mode 100644 JbossRich/JavaSource/City.java
create mode 100644 JbossRich/JavaSource/dwRF4D1Handler.java
create mode 100644 JbossRich/JavaSource/dwRF4Demo1.properties
create mode 100644 JbossRich/JavaSource/resources/application.properties
create mode 100644 JbossRich/WebContent/META-INF/MANIFEST.MF
create mode 100644 JbossRich/WebContent/WEB-INF/classes/City.class
create mode 100644 JbossRich/WebContent/WEB-INF/classes/dwRF4D1Handler.class
create mode 100644 JbossRich/WebContent/WEB-INF/classes/dwRF4Demo1.properties
create mode 100644 JbossRich/WebContent/WEB-INF/classes/resources/application.p
roperties
create mode 100644 JbossRich/WebContent/WEB-INF/faces-config.xml
create mode 100644 JbossRich/WebContent/WEB-INF/lib/cssparser-0.9.5.jar
create mode 100644 JbossRich/WebContent/WEB-INF/lib/guava-11.0.2.jar
create mode 100644 JbossRich/WebContent/WEB-INF/lib/richfaces-components-api-4.
2.0.Final.jar
create mode 100644 JbossRich/WebContent/WEB-INF/lib/richfaces-components-ui-4.2
.0.Final.jar
create mode 100644 JbossRich/WebContent/WEB-INF/lib/richfaces-core-api-4.2.0.Fi
nal.jar
create mode 100644 JbossRich/WebContent/WEB-INF/lib/richfaces-core-impl-4.2.0.F
inal.jar
create mode 100644 JbossRich/WebContent/WEB-INF/lib/sac-1.3.jar
create mode 100644 JbossRich/WebContent/WEB-INF/web.xml
create mode 100644 JbossRich/WebContent/css/default.css
create mode 100644 JbossRich/WebContent/images/DukeGuitar.jpg
create mode 100644 JbossRich/WebContent/images/myphoto.jpg
create mode 100644 JbossRich/WebContent/images/roseTab.jpg
create mode 100644 JbossRich/WebContent/index.xhtml
create mode 100644 JbossRich/WebContent/result.xhtml
create mode 100644 JbossRich/ant/build.properties

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)

msjo@HY139275 ~/GitRepo/Hello-World (master)
$ git push -u origin master
Enter passphrase for key '/c/Users/msjo/.ssh/id_rsa':
Counting objects: 48, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (47/47), 6.87 MiB | 11 KiB/s, done.
Total 47 (delta 2), reused 0 (delta 0)
To git@github.com:demj33/Hello-World.git
020f976..3eae909 master -> master
Branch master set up to track remote branch master from origin.

msjo@HY139275 ~/GitRepo/Hello-World (master)
$

Remote Repo : https://github.com/mjtoolbox/Hello-World

Resources

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s