Android studio: share code on Github and add SSH key to you Git
Welcome to this post. In this post, we are going to discuss how to share code on Git from Android Studio.
(I don't want to describe what is GitHub or why you need to use git. I just want to show you the process only)
Let's jump in.
Before share, you need to create a GitHub account click here for GitHub account.
After creating a GitHub account, you can now share your code into GitHub.
Open android studio. Now open an exciting project that you want to share.
Click on VCS on the main toolbar.
then import into version
after Share project on GitHub
Like below picture
You will get an error. To fix this error you need to add an SSH key.
Open git-bash
To add this you need to check first if you have any key open git-bash.
Now enter the command
if the key already exists you can jump on the copy to clip bord option.
If the key does not exist then you need to create a new key.
Follow this command-
it will show-
Note for the beginner: If you enter your password it will not showing anything (even no start).
Now you need to add your SSH key to the ssh-agent before adding, you need to ensure the ssh-agent is running: to run ssh-agent-
show the picture
Time to add this key into you Github account.
Login your GitHub and go to Settings.
Select SSH and GPG key Now click New SSH key.
write the title as you want and the key will be your copied key.
press ctrl+c button to paste the copied key.
and save this by pressing add SSH key.
That's it. It will be working fine
Now click on
VCS on the main toolbar.
then import into version
after Share project on GitHub
it will show like below picture
if you are not logged in then it will prompt to login. Log in through your Github user name, and pass.
After login, it will show like this-
Now write a short description about your project
(I don't want to describe what is GitHub or why you need to use git. I just want to show you the process only)
Let's jump in.
Before share, you need to create a GitHub account click here for GitHub account.
After creating a GitHub account, you can now share your code into GitHub.
Open android studio. Now open an exciting project that you want to share.
Click on VCS on the main toolbar.
then import into version
after Share project on GitHub
Like below picture
Open git-bash
To add this you need to check first if you have any key open git-bash.
Now enter the command
ls -al ~/.ssh
if the key already exists you can jump on the copy to clip bord option.
If the key does not exist then you need to create a new key.
Follow this command-
ssh-keygen -t rsa -b 4096 -C "your@email.com"
in your@email.com you need to write your email that you used in GitHub account.Generating public/private rsa key pair.When you're prompted to "Enter a file in which to save the key," press Enter if you want to save those file in the default location.
Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
now enter your password.Note for the beginner: If you enter your password it will not showing anything (even no start).
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again]your password must be same. your SSH key is created.
Now you need to add your SSH key to the ssh-agent before adding, you need to ensure the ssh-agent is running: to run ssh-agent-
eval $(ssh-agent -s)Now add your ssh private key to ssh-agent
ssh-add ~/.ssh/id_rsa
Now run this command this command will copy the key into you clip bord.clip < ~/.ssh/id_rsa.pub
show the picture
Time to add this key into you Github account.
Login your GitHub and go to Settings.
Select SSH and GPG key Now click New SSH key.
write the title as you want and the key will be your copied key.
press ctrl+c button to paste the copied key.
and save this by pressing add SSH key.
That's it. It will be working fine
Now click on
VCS on the main toolbar.
then import into version
after Share project on GitHub
it will show like below picture
if you are not logged in then it will prompt to login. Log in through your Github user name, and pass.
After login, it will show like this-
Now write a short description about your project
it will promote like this
write commit message
And click ok.
Note: after you find a popup window of Git and login in with your GitHub account details.
It will share your project in Github.
Login to your Github account you will find your project.
Thanks for reading.
Hope you will post will help you and you are now able to share project on GitHub
Happy coding.
And click ok.
Note: after you find a popup window of Git and login in with your GitHub account details.
It will share your project in Github.
Login to your Github account you will find your project.
Thanks for reading.
Hope you will post will help you and you are now able to share project on GitHub
Happy coding.
No comments :