React-native Post 3: How to init git with react-native project

 Step 1: Create repository on github.
 Step 2: Now run following commands 

git init

Click on SSH button which was placed after HTTPS button and before repository name.

Now copy the 

  if new project then => git remote add origin git@github.com:Prkarena/sagarsamaj.git 

  if project with other git url then => git remote set-url origin git@github.com:Prkarena/sagarsamaj.git  

Now check remote -b by command

git remote -v 

origin  https://github.com/Prkarena/reponame.git (fetch) 
origin  https://github.com/Prkarena/reponame.git (push)

git add .

git commit -m "message for commit the code" 

Now configure user name and password for that repository specific 

git config user.email "your_email@gmail.com"

git config user.name "github_username"

git config user.password "github_password"


Now try to push the code by command 

git push origin development 

But you can get this type of error: 

remote: Repository not found.

fatal: repository 'https://github.com/yourname/reponame.git/' not found 

To resolve this issue will create ssh key in our system and will use that key in github so that we can push our content on remote github.

Run this command:

ssh-keygen -t rsa -C "youremail@gmail.com"

and you will get data like below 

Generating public/private rsa key pair.

Enter file in which to save the key (/home/prakash/.ssh/id_rsa):  (leave this empty and hit enter )

Enter passphrase (empty for no passphrase):  (You can enter password / leave empty)

Enter same passphrase again:  (enter same data again which you added above passphrase)

 You will see this type of output

Your identification has been saved in /home/prakash/.ssh/id_rsa

Your public key has been saved in /home/prakash/.ssh/id_rsa.pub

The key fingerprint is:

SHA256:ghFzruq1z______geO0ao4 karenaprakash14@gmail.com

The key's randomart image is:

+---[RSA 3072]----+

|oo.=o..          |

|O B =            |

|E# O +           |

|O++ *            |

+----[SHA256]-----+


    That's it now run this command in linux to see ssh key 

 cat < ~/.ssh/id_rsa.pub

     Now copy that ssh and open this github screen and go to SSH and GPG keys and add your copied ssh into that github's ssh and save that ssh. that's it now try again below command to push the content and you will be able to upload your change on github.

git push origin development 




Post a Comment

Previous Post Next Post