Saving Your Ruby On Rails Application Code To Github.com

Introduction

In this article you will learn git configuration in git bash and git hub repository creation, add new ssh key in git hub and finally add all application files into git hub repository via remotely using with git bash in Ruby on Rails.

Requirements

  • Ruby on Rails Installed In Your System.
  • Git bash
  • Git hub Account 
  • Google Chrome Web Browser.

Step 1

Create a new application in rails command prompt using following code.

  1. Rails new stock  
 

Once you enter the code, it will take some time to create the app.

 

Step 2

Now open git bash and root your application directory.

 

Step 3

Now configure your git hub details in git bash prompt using following code run one by one.

  1. Git config –global user.name “user name”  
  2.   
  3. Git config –global user.email “user email”  
  4.   
  5. Git config –global push.default matching  
  6.   
  7. Git config –global alias.co checkout  
  8.   
  9. Git init  

 

Step 4

Now, search git hub in your browser and login your account in git hub, then create new repository.

 

Give a repository name and click create repository button.
 
 

Git hub repository created successfully.

 

Step 5

Now , click your profile icon and open settings.

 

Now, open SSH and GPS keys menu in personal settings and add new SSH key.

 

Give a SSH key title and copy SSH public key from rails command prompt.

 
 

Then paste the key into the key requesting field and click add SSH key button.

 

The SSH key added successfully.

Step 6

Now, back to git bash and adding the rails application files in git hub to use following code.

  1. Git add .  

 

Once you enter the code, it will take some time to add application files in git hub.
 
 

Step 7

Now, upload application files in git hub repository with comment to use following code.

  1. Git commit –m “initial commit”  

 

Once you enter the code, it will take some time to create file allocation space in git hub repository.
 
 

Step 8

Now, we connect our git bash and git hub repository through remote access to use following code.

  1. Git remote add origin git@github.com:PrakashrajP/stock.git  

 

Step 9

Now, push our all application files in git hub use following code.

  1. Git push –u origin master  

 

Once you enter the code, it will take some time to upload all files remotely in our git hub repository.
 
 

Step 10

Now, back to git hub and open our repository.

 

Now, you can see your application files are successfully stored in git hub repository,

 

After adding files in repository now we can control application version through replace application files in repository.


Similar Articles