Thursday, September 28, 2023

How to Change Git Remote Origin: A Step-by-Step Guide

Introduction

Changing the remote origin of your Git repository is a common task, especially when you need to move your repository to a different hosting service or update its URL. In this step-by-step guide, we will walk you through the process of changing the remote origin of your Git repository.

Prerequisites

Before you begin, make sure you have the following:

  • A Git repository with the current remote origin.
  • A new URL or location where you want to set the new remote origin.

Step 1: Verify the Current Remote Origin URL

Open your terminal and navigate to your Git repository's root directory. Use the following command to view your current remote configuration:

git remote -v

This command will display the current remote origin URL, fetch URL, and push URL.

Step 2: Remove the Current Remote Origin (Optional)

If you wish to completely remove the existing remote origin, use the following command:

git remote remove origin

This step is optional, and you can skip it if you want to keep the current remote origin as a backup.

Step 3: Add the New Remote Origin

To add the new remote origin, use the following command, replacing <new_remote_url> with the URL of your new remote repository:

        git remote add origin <new_remote_url> [OR]
        git remote set-url origin <new_remote_url>
        

Step 4: Verify the New Remote Origin

Confirm that the new remote origin has been set correctly by running:

git remote -v

You should see the new remote origin URL listed for both fetch and push.

Step 5: Update Your Local Branches

To update your local branches to track the new remote origin, use the following command:

git branch -u origin/main

Replace main with the name of the branch you want to track.

Step 6: Push Your Branches to the New Remote

If you have existing branches you'd like to push to the new remote origin, use the following command to push them:

git push -u origin <branch_name>

Replace <branch_name> with the name of the branch you want to push.

Step 7: Test the New Remote Origin

Ensure that everything is working correctly by testing the new remote origin:

git pull origin main

Replace main with the name of the branch you're testing.

Conclusion

You've successfully changed the remote origin of your Git repository. This process is essential when migrating repositories or updating remote URLs. Remember to update any references to the old remote origin in your development environment.

Note: Be cautious when changing the remote origin, as it can affect collaboration and access to your repository. Make sure to communicate any changes to your team and update any necessary documentation or CI/CD configurations to reflect the new remote URL.

Deploying a React Project on an Ubuntu Server: A Step-by-Step Guide

Introduction

Deploying a React project on an Ubuntu server is a crucial step to make your web application accessible to users worldwide. In this tutorial, we'll walk through the process of deploying a React project on an Ubuntu server, complete with step-by-step instructions and accompanying images to guide you along the way.

Prerequisites

Before you begin, ensure you have the following:

  • An Ubuntu server (either a physical server or a virtual machine)
  • Basic knowledge of the Linux command line
  • Node.js and npm installed on your server
  • Your React project's build files ready for deployment

Step 1: Connect to Your Ubuntu Server

Begin by accessing your Ubuntu server using SSH. Open your terminal and run the following command:

ssh username@server_ip_address

Replace username with your server's username and server_ip_address with your server's actual IP address.

Step 2: Update and Upgrade

It's a good practice to ensure your server is up to date before proceeding with deployment. Run the following commands:

sudo apt update
sudo apt upgrade

Step 3: Install a Web Server (Nginx)

Nginx will serve as the web server for your React application. Install Nginx using:

sudo apt install nginx

After installation, start Nginx and enable it to start on boot:

sudo systemctl start nginx
sudo systemctl enable nginx

Step 4: Serve Your React Build

Navigate to your React project's build directory. If your project is ready for deployment, you should have a build directory containing optimized production-ready files. Copy these files to Nginx's default serving directory:

sudo cp -r /path/to/your/build/* /var/www/html

Step 5: Configure Nginx for React

Create a new Nginx server block configuration for your React application:

sudo nano /etc/nginx/sites-available/react-app

Add the following configuration, adjusting the domain and other settings as needed:

            
server {
    listen 80;
    server_name your_domain.com www.your_domain.com;

    location / {
        root /var/www/html;
        index index.html;
        try_files $uri $uri/ /index.html;
    }
}
            
        

Save and close the file. Then, create a symbolic link to enable the new configuration:

sudo ln -s /etc/nginx/sites-available/react-app /etc/nginx/sites-enabled

Step 6: Test and Restart Nginx

Before restarting Nginx, test the configuration for syntax errors:

sudo nginx -t

If the test is successful, restart Nginx to apply the changes:

sudo systemctl restart nginx

Step 7: Configure Domain and DNS (Optional)

If you have a domain name, configure the DNS settings to point to your server's IP address.

Step 8: Access Your React App

Open a web browser and enter your domain or server's IP address. You should see your React application live and accessible to users.

Conclusion

Congratulations! You've successfully deployed your React project on an Ubuntu server using Nginx as the web server. By following this guide, you've made your application accessible to users worldwide. Remember, deploying a web application is an iterative process, so ensure you keep your server and application up to date for optimal performance and security.

Remember, the provided commands and configurations are generic examples and may need to be adapted to your specific project and server environment. Always ensure you understand the commands you are using and the changes you're making to your server. Happy deploying!

Thursday, May 11, 2017

How to solve internet problem for ubuntu in virtual box?

You can access internet on virtual box by two way one is bridge network or host only. today i show you the host only option.


  1. First you need to create a Host only network in virtual box
    1. virtual box -> file -> preferences -> network -> Host-only network 
    2. Click add button
    3. Click DHCP, click Enable Server

    4. Select virtual OS, go to setting -> network

  2. Now login to your ubuntu os and do the following 
          sudoedit /etc/network/interfaces
  1. 
    # The loopback network interface
    auto lo
    iface lo inet loopback
    # NAT
    auto eth0
    iface eth0 inet dhcp
    # Host only
    auto eth1
    iface eth1 inet dhcp
After VM reboot hope everything worked fine.


Tuesday, July 13, 2010

How to create table/Column

To create Column need to add some code in storage-conf.xml.The next thing we need to do is to locate and configure the database storage-conf.xml file.which is found in conf folder.Open the storage-conf.xml in your favorite text editor.now Add the following code under tag.




<Keyspace Name="Blog">
        <ColumnFamily Name="Post"
                      ColumnType="Super"
                      CompareWith="UTF8Type"
                      CompareSubcolumnsWith="UTF8Type"
                      Comment="A column family with supercolumns, whose column and subcolumn names are UTF8 strings"                      />
    </Keyspace>



save it.The above configuration creates one Column Family(or table).called Posts in a Keyspace (or database ) called Blog.
We are going to use this column family in our code below.

Saturday, April 3, 2010

Cassandra Installation on WindowsXP

1.About Cassandra :
Cassandra is an open source distributed database management system. It is an Apache Software Foundation top-level project designed to handle very large amounts of data spread out across many commodity servers while providing a highly available service with no single point of failure. It is a No SQL solution that was initially developed by Facebook and powers their Inbox Search feature.
Want to Know more? Visit
Cassandra database
Apache Cassandra

2.Cassandra Installation on WindowsXP
First we need to download Cassandra.For Download Cassandra Click this link Download. Now unzip the file and put it into a drive where you want to install Cassandra.you can change the folder name cause deafult name is "apache-cassandra-0.5.1".its to long to remember easily.So i change my unzip folder name to "cassandra". Now we have our Cassandra in a spacific drive.Lets go install and configur Cassandra database on windowsXP.You need to install java 1.6.for JAVA download
i) First Step :
First we need to add Two Environment Variables. One for java and other for Cassandra home Directory.Bellow show how to set the Environment Variables on WindowsXp.

Click start then select My Computer and Click Right button on mouse.After that it show System properties Tab manu.Now Select Advanced Tab.


 Now select Environment Variables button.Its open Environment Variables set window like bellow.


Now Select New From System Variables Section.its open a new window like bellow.


Fill Variable name section to "JAVA_HOME" and Variable value to java jdk path. I install java to my C:\program files folder for this my java jdk path is "C:\program Files\java\jdk1.6.0_18" please change this path with your java installation path. same way set CASSANDRA_HOME path.my Cassandra is "F:\cassandra" casue i put Cassandra unzip folder to f drive and i change it to cassandra.please change it with your cassandra dirve.



Now click ok-&gt;apply and your Environment Variables setting is completed.Now lest go to run Cassandra and connect with database.Again Click Start then click run and type cmd in text box on run window and Enter .it open commend mode on windows.Like this.
Now type f: then enter and then type cd cassandra\bin and enter.here f is the drive where my cassandra folder is.now its look like this

First you need some change in configuration file . for edit configuration file please open "storage-conf.xml" file on any txt editor and write this line under

<replicationfactor>1</replicationfactor> tag.

<commitlogdirectory>F:/cassandra/data/commitlog</commitlogdirectory>
<datafiledirectories>
<datafiledirectory>F:/cassandra/data/data</datafiledirectory></datafiledirectories>
<calloutlocation>F:/cassandra/data/callouts</calloutlocation>
<stagingfiledirectory>F:/cassandra/data/staging</stagingfiledirectory>

you find this configuration file on F:\cassandra\conf this location. please change Directory with your Cassandra Directory. Now type cassandra.bat and Enter.if it run correctly the commend prompt show like this
Its mean the Cassandra server run correctly.if you check your my computer then you found there is a extra drive created with same name where your Cassandra folder is.Now type cassandra-cli.bat on your commend and Enter.it will show a welcome message.now connect with Thrift.type connect / its mean connect localhost/9160 and enter.here 9160 is your ThriftPort that define in configuration file in defult.after run this commend your commend prompt look like this

its show connected to localhost/9160 its mean you are connect to Thrift.if want to check is your connection is ok or not type show keyspaces and enter.its shows your default Keyspace name.like this

That's all for now .In my next post i try to told you about how to create database and other.

Please told me is this helpful.i am not good in English if do any mistake please forgive me.