Adding project to Github

After two months, I decided to upload WebsocketDemo project to Github. Since then, I replaced my laptop and all the settings are gone. Also, I haven’t used Github for two months. Instead of using GUI, I used Git bash to upload my project.

Well, I made the same mistake again…. naming remote and origin differently, so I ended up deleting in both places. To do it properly, I should follow below steps:

1. Create Repository in Github. Skip readme.

2. Open Gitbash and navigate to c:/Users/msjo/GitRepo

3. Make repository directory same as the one in the Github.

4. Update README

5. Add origin to git remote

6. Push origin to remote master

msjo@MSJO-PC ~
$ cd gitrepo

msjo@MSJO-PC ~/gitrepo
$ ls

msjo@MSJO-PC ~/gitrepo
$ mkdir WebsocketDemo

msjo@MSJO-PC ~/gitrepo
$ cd WebsocketDemo

msjo@MSJO-PC ~/gitrepo/WebsocketDemo
$ git init
Initialized empty Git repository in c:/Users/msjo/gitrepo/WebsocketDemo/.git/

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ touch README

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git add README

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git commit -m 'first commit'
[master (root-commit) 824a40b] first commit
 0 files changed
 create mode 100644 README

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git remote add origin https://github.com/mjtoolbox/WebsocketDemo.git

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git push -u origin master
usage: git credential-cache [options]

    --exit                tell a running daemon to exit
    --reject              reject a cached credential
    --timeout          number of seconds to cache credentials
    --socket        path of cache-daemon socket
    --chain       use  to get non-cached credentials
    --username      an existing username
    --description   human-readable description of the credential
    --unique       a unique context for the credential

Username for 'https://github.com':
Password for 'https://mjtoolbox@github.com':
usage: git credential-cache [options]

    --exit                tell a running daemon to exit
    --reject              reject a cached credential
    --timeout          number of seconds to cache credentials
    --socket        path of cache-daemon socket
    --chain       use  to get non-cached credentials
    --username      an existing username
    --description   human-readable description of the credential
    --unique       a unique context for the credential

fatal: Authentication failed

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git push -u origin master
usage: git credential-cache [options]

    --exit                tell a running daemon to exit
    --reject              reject a cached credential
    --timeout          number of seconds to cache credentials
    --socket        path of cache-daemon socket
    --chain       use  to get non-cached credentials
    --username      an existing username
    --description   human-readable description of the credential
    --unique       a unique context for the credential

Username for 'https://github.com':
Password for 'https://mjtoolbox@github.com':
usage: git credential-cache [options]

    --exit                tell a running daemon to exit
    --reject              reject a cached credential
    --timeout          number of seconds to cache credentials
    --socket        path of cache-daemon socket
    --chain       use  to get non-cached credentials
    --username      an existing username
    --description   human-readable description of the credential
    --unique       a unique context for the credential

To https://github.com/mjtoolbox/WebsocketDemo.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ ls
README  WebContent  build  src

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git add .
warning: LF will be replaced by CRLF in WebContent/WEB-INF/faces-config.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in WebContent/WEB-INF/sun-web.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in WebContent/css/oneColFixCtr.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in WebContent/js/jquery-1.7.2.min.js.
The file will have its original line endings in your working directory.

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git status -s
A  .classpath
A  .metadata/WebContent/WEB-INF/faces-config.pageflow
A  .project
A  .settings/.jsdtscope
A  .settings/oracle.eclipse.tools.webtier.ui.prefs
A  .settings/org.eclipse.jdt.core.prefs
A  .settings/org.eclipse.wst.common.component
A  .settings/org.eclipse.wst.common.project.facet.core.prefs.xml
A  .settings/org.eclipse.wst.common.project.facet.core.xml
A  .settings/org.eclipse.wst.jsdt.ui.superType.container
A  .settings/org.eclipse.wst.jsdt.ui.superType.name
A  WebContent/ChatWindow.xhtml
A  WebContent/META-INF/MANIFEST.MF
A  WebContent/WEB-INF/faces-config.xml
A  WebContent/WEB-INF/sun-web.xml
A  WebContent/WEB-INF/web.xml
A  WebContent/client.html
A  WebContent/css/oneColFixCtr.css
A  WebContent/index.xhtml
A  WebContent/js/jquery-1.7.2.min.js
A  build/classes/resources/application.properties
A  build/classes/serverApp/MyWebSocketApplication.class
A  build/classes/servlet/WebSocketServlet.class
A  build/classes/socket/ClientSocket.class
A  src/resources/application.properties
A  src/serverApp/MyWebSocketApplication.java
A  src/servlet/WebSocketServlet.java
A  src/socket/ClientSocket.java

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git remote add origin https://github.com/mjtoolbox/WebsocketDemo.git
fatal: remote origin already exists.

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ ls
README  WebContent  build  src

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git commit -m 'initially added'
[master 73776b7] initially added
warning: LF will be replaced by CRLF in WebContent/WEB-INF/faces-config.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in WebContent/WEB-INF/sun-web.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in WebContent/css/oneColFixCtr.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in WebContent/js/jquery-1.7.2.min.js.
The file will have its original line endings in your working directory.
 28 files changed, 598 insertions(+)
 create mode 100644 .classpath
 create mode 100644 .metadata/WebContent/WEB-INF/faces-config.pageflow
 create mode 100644 .project
 create mode 100644 .settings/.jsdtscope
 create mode 100644 .settings/oracle.eclipse.tools.webtier.ui.prefs
 create mode 100644 .settings/org.eclipse.jdt.core.prefs
 create mode 100644 .settings/org.eclipse.wst.common.component
 create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.prefs.xm
l
 create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml
 create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container
 create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name
 create mode 100644 WebContent/ChatWindow.xhtml
 create mode 100644 WebContent/META-INF/MANIFEST.MF
 create mode 100644 WebContent/WEB-INF/faces-config.xml
 create mode 100644 WebContent/WEB-INF/sun-web.xml
 create mode 100644 WebContent/WEB-INF/web.xml
 create mode 100644 WebContent/client.html
 create mode 100644 WebContent/css/oneColFixCtr.css
 create mode 100644 WebContent/index.xhtml
 create mode 100644 WebContent/js/jquery-1.7.2.min.js
 create mode 100644 build/classes/resources/application.properties
 create mode 100644 build/classes/serverApp/MyWebSocketApplication.class
 create mode 100644 build/classes/servlet/WebSocketServlet.class
 create mode 100644 build/classes/socket/ClientSocket.class
 create mode 100644 src/resources/application.properties
 create mode 100644 src/serverApp/MyWebSocketApplication.java
 create mode 100644 src/servlet/WebSocketServlet.java
 create mode 100644 src/socket/ClientSocket.java

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$ git push -u origin master
usage: git credential-cache [options]

    --exit                tell a running daemon to exit
    --reject              reject a cached credential
    --timeout          number of seconds to cache credentials
    --socket        path of cache-daemon socket
    --chain       use  to get non-cached credentials
    --username      an existing username
    --description   human-readable description of the credential
    --unique       a unique context for the credential

Username for 'https://github.com':
Password for 'https://mjtoolbox@github.com':
usage: git credential-cache [options]

    --exit                tell a running daemon to exit
    --reject              reject a cached credential
    --timeout          number of seconds to cache credentials
    --socket        path of cache-daemon socket
    --chain       use  to get non-cached credentials
    --username      an existing username
    --description   human-readable description of the credential
    --unique       a unique context for the credential

To https://github.com/mjtoolbox/WebsocketDemo.git
   824a40b..73776b7  master -> master
Branch master set up to track remote branch master from origin.

msjo@MSJO-PC ~/gitrepo/WebsocketDemo (master)
$
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