DEV Community

Tegar Sabila
Tegar Sabila

Posted on

How to Upload Project to Github Using Termux, SSH Method.

upload project using termux

this is tutorial uploading files using termux using ssh method.

Langkah awal adalah menjalankan aplikasi termux terlebih dahulu

  • The first step is to run the termux application first

ketika sudah, kita akan menginstal beberapa package yang diperlukan untuk melakukan push github menggunakan metode ssh

  • When it's done, we'll install some of the packages needed to push github using the ssh method
$ pkg install openssh && pkg install git
Enter fullscreen mode Exit fullscreen mode

Image description

ketika sudah menginstall openssh dan git, langkah selanjutnya adalah membuat ssh-keygen terlebih dahulu

  • When you have installed openssh and git, the next step is to create an ssh-keygen first
$ ssh-keygen
Enter fullscreen mode Exit fullscreen mode

kemudian akan di minta untuk mengisi beberapa opsi, untuk enter file in which to save the key, kalian langsung enter saja. Lalu diminta untuk memasukan passphrase, Kalian isi bebas. Tapi perlu di ingat passphrase ini penting untuk di pakai jika kalian meremote github kalian

  • Then you will be asked to fill in several options, to enter file in which to save the key, you just enter. Then asked to enter a passphrase, you are free to fill in. But keep in mind that this passphrase is important to use if you remotely use your github

Image description

jika ssh-keygen sudah berhasil dibuat, kalian masuk ke direktori $HOME/.ssh, lalu ssh key public kalian ada disitu. Gunakan perintah cat untuk salin ssh key nya.

  • if the ssh-keygen has been successfully created, you go to the $HOME/.ssh directory, then your public ssh key is there. Use the cat command to copy the ssh key.

Image description

Lalu kalian salin ssh key nya

  • then you copy the ssh key

Image description

selanjutnya kembali lagi ke aplikasi termux kalian dan jalankan perintah "ssh -T git@github.com"
Jika sudah lalu masukan passphrase yang sudah kalian buat.
Lalu enter, jika berhasil maka akan tampil username github kalian.

  • then go back to your termux application and run the command "ssh -T git@github.com" If so, then enter the passphrase that you have created. Then enter, if successful, your github username will appear.

lalu setelah itu buka github kalian, selanjutnya ke menu settings lalu ke menu SSH and GPG Keys. Lalu klik new ssh, selanjutnya masukan key ssh kalian dan isi nama untuk ssh key kalian (bebas)

  • then after that open your github, then go to the settings menu then go to the SSH and GPG Keys menu. Then click new ssh, then enter your ssh key and fill in the name for your ssh key (free)

Image description

jika sudah, kalian add ssh key. Dan sini github kalian sudah terkoneksi ke terminal termux kalian.

  • if so, you add the ssh key. And here your github is connected to your termux terminal.

selanjutnya kembali lagi ke aplikasi termux kalian dan jalankan perintah "ssh -T git@github.com"
Jika sudah lalu masukan passphrase yang sudah kalian buat.
Lalu enter, jika berhasil maka akan tampil username github kalian.

  • then go back to your termux application and run the command "ssh -T git@github.com" If so, then enter the passphrase that you have created. Then enter, if successful, your github username will appear.
$ ssh -T git@github.com
Enter fullscreen mode Exit fullscreen mode

sekarang masuk ke tahap cara upload atau cara melakukan git push ke repository github kalian.

  • now go to the stage of how to upload or how to do a git push to your github repository.

langkah pertama, kalian masuk ke dalam folder yang akan di jadikan repository lokal.

  • the first step, you go into the folder that will be used as a local repository.
$ cd (folder name)
Enter fullscreen mode Exit fullscreen mode

Lalu masukan perintah git init, untuk membuat konfigurasi git pada folder tersebut

  • Then enter the git init command, to make a git configuration in that folder
$ git init
Enter fullscreen mode Exit fullscreen mode

selanjutnya gunakan perintah git add (nama file) untuk menambahkan file yang akan di push

  • then use the command git add (filename) to add files to be pushed
$ git add (filename)
Enter fullscreen mode Exit fullscreen mode

atau untuk memilih semua file gunakan perintah

  • or to select all files use command
$ git add .
Enter fullscreen mode Exit fullscreen mode

selanjutnya buat commit nya

  • then make the commit
$ git commit -m "isi bebas"
Enter fullscreen mode Exit fullscreen mode

jika sudah buat branch nya

  • if you have created a branch
$ git branch -M (your branch name)
Enter fullscreen mode Exit fullscreen mode

lalu remote repository kalian yang akan di jadikan tempat push file nya. Di sini kita menggunakan metode ssh, jadi kita akan membuat remote untuk ssh nya bukan untuk https

  • then your remote repository that will be used as a place for the push file. Here we use the ssh method, so we will create a remote for ssh instead of https
$ git remote add (remote name) git@github.com:username/repository.git
Enter fullscreen mode Exit fullscreen mode

contoh nya

  • example
$ git remote add origin git@github.com:tegarsabila/coba.git
Enter fullscreen mode Exit fullscreen mode

lalu tinggal tahap push nya dengan menggunakan perintah git push, setelah enter akan diminta passphrase nya. Kalian masukan passphrase yang sudah kalian buat pada ssh-keygen sebelumnya

  • then just push it by using the git push command, after entering it will ask for the passphrase. You enter the passphrase that you created in the previous ssh-keygen
$ git push -u (remote name) (branch name)
Enter fullscreen mode Exit fullscreen mode

contoh nya

  • example
$ git push -u origin main
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)