before we talk to far, you should to know what is remote? what is repository?, what is push or pull? what is commit? and another about git!
but in this article, wen jus't will only discuss how to remote a repository, so here we go!
article will be continue in bahasa indonesia
cara untuk memastikannya adalah dengan membuka terminal atau CMD di Windows > lalu ketikan git -v
jika tampil seperti dibawah ini maka telah menginstall git, namun jika belum maka keterangan versi tersebut tidak akan muncul, maka dari itu silahkan download git pada halaman berikut ini
- GIt for Windows https://git-scm.com/download/win
- Git for Mac OS https://git-scm.com/download/mac
![image](https://private-user-images.githubusercontent.com/48278734/266332387-995910fb-c7c8-46a3-948f-3b5d14fbe331.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjYzMzIzODctOTk1OTEwZmItYzdjOC00NmEzLTk0OGYtM2I1ZDE0ZmJlMzMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFlZjQ1NmNkMzU1NzFlNjhiMDkzMjBjZDczNjYwMDc4NWFhYjk0ZmZkYjgyOGVjN2U0YjJhZTMzMjQ1MjBjNjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OetFdIrYxPs5ybPoCtTmdujo9V0RY_24OF4E3rlCQ6c)
gambar 0. install git
jika sudah berhasil menginstall git kedalam sistem operasi anda, maka selanjutnya dapat lakukan konfigurasi secara global nama dan email anda yang tehubung ke github dengan melakakukan perintah :
git config --global user.name "Nama Anda"
git config --global user.email "[email protected]"
atau seperti gambar dibawah ini :
![image](https://private-user-images.githubusercontent.com/48278734/266680773-f9418e44-d828-47c3-b5a4-c8891dc6b2f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY2ODA3NzMtZjk0MThlNDQtZDgyOC00N2MzLWI1YTQtYzg4OTFkYzZiMmY5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM2NmU3OWY5ZjU0ZGQ0MzFkZGM3ZGZmYWJkMmE0YmQ4ODY5OGQ1N2ZiYTRlOTg2Zjk4MTgyM2VmYThkY2RmZTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WfO4I5imv3T7SFIn6NsrqpqMKkPl8fOpjLUMmxIlfEo)
gambar 0.1. configure git
jika sudah berhasil maka anda dapat melihat konfigurasi anda pada list configurasi dengan perintah :
git config --list
![image](https://private-user-images.githubusercontent.com/48278734/266475218-14c4c6b4-c3ec-4183-aa07-fa9a44d184db.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzUyMTgtMTRjNGM2YjQtYzNlYy00MTgzLWFhMDctZmE5YTQ0ZDE4NGRiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlkZGY4MDAzNDc1YjY0YThmZWEzMmZlYTg3ZWI1OWVmZDE4NzM3Yzg2NjQ0NTc1MjNhMzIwNGM2ZTliMTY0ZDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.7EGoTFAcBJ1Wnpk5xr4WHB7q3HEvoGFR3ISnErA7BOA)
gambar 1. repository in github
![image](https://private-user-images.githubusercontent.com/48278734/266475277-70e074fc-ac2d-4fb4-be44-7162102c7dff.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzUyNzctNzBlMDc0ZmMtYWMyZC00ZmI0LWJlNDQtNzE2MjEwMmM3ZGZmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRiNWE2NzA3ZTc1YmY2OGVkZGU0ZDVhYTgyNzAyZjM0ODI1Y2Y5MjQ3N2FmMTZkNWU0YzI1ZDIyNjBjNTU0YWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._t-3XcUvL1_2pNeTgDny0tvThAMXloxxhvYZEIB4ewc)
gambar 2. open project folder to code editor
untuk membka terminal pada visual studio code anda dapat memilih menu terminal > pilih new terminal
![image](https://private-user-images.githubusercontent.com/48278734/266475395-2763dd3e-e7be-46ec-ae8d-b1d53df29a2e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzUzOTUtMjc2M2RkM2UtZTdiZS00NmVjLWFlOGQtYjFkNTNkZjI5YTJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTljZGIzY2FlYzNkOTg5OGZiY2VkZDdlNzU0NDQ0MTQ3NWMzMTI4YmE2NDFmYzA0MjFjMTgyYWQ5MDVhN2UwZGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uszV0jtWso4i-Fay9RDO0mdmHNi47NtoMH7kEK1Fsfk)
gambar 3. open terminal
- untuk clonning repository anda dapat copy link bagian https (pada gambar 4)
![image](https://private-user-images.githubusercontent.com/48278734/266475464-4d51b822-ec18-48f4-b690-663963a7145a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzU0NjQtNGQ1MWI4MjItZWMxOC00OGY0LWI2OTAtNjYzOTYzYTcxNDVhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI4YTg2NjJhM2ZhYzZhNDM1MjQyMzM5ZmFhMjVlYTgxNjYxZjAxZGYyZTc0ZDI0NDEwYzI1MTQ2NDVmODViMTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.7Ktnfc7KlWIVrNt2vd740D4QZY23HW21lucorA4Wp6o)
gambar 4. open terminal
-
masukan perintah berikut (ganti repository_url dengan link repository yang sudah anda copy sebelumnya) :
-
branch name dapat dilihat, secara default ada yang menggunakan main atau master pada gambar 5.1
git init git remote add origin <repositori_url> git pull origin <branch name> git add . git commit -m "message" git push -u origin <branch name>
![image](https://private-user-images.githubusercontent.com/48278734/266475605-da7d94a6-f96e-474a-b142-f7fe994d8675.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzU2MDUtZGE3ZDk0YTYtZjk2ZS00NzRhLWIxNDItZjdmZTk5NGQ4Njc1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEyNDc0YTAzYmRmMDUyNjYyZDU1MjEyZDRmYzdhMTM4MGZkMTNhODQzNGNiNGEwYjA1ODdlNjIzZmQ4NjQ0YjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.bqOfV2XEPYwxB21D9MQtNAgMbJFoDJFf_qpmP2IX1nc)
gambar 5. terminal script
![Screenshot 2023-09-09 at 00 05 05](https://private-user-images.githubusercontent.com/48278734/266682661-20ef957f-c730-4a39-8d88-665b6d2e04e8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY2ODI2NjEtMjBlZjk1N2YtYzczMC00YTM5LThkODgtNjY1YjZkMmUwNGU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk0MjM5NjE3Mjg3OGY0YjFhNmE1NDcyMjY3MTViZjM5N2QxMmQyN2QwMTYyMTc4YTAzZjEyNTljMmVlYzRkMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.iABlay0kHNIlahdkeHpKOOSskdGW8HWCIZuqXVO_IqE)
gambar 5.1 pilih branch utama
and here we go! sudah berhasil push di github
![image](https://private-user-images.githubusercontent.com/48278734/266475867-97644a13-bd2e-4734-90fb-5de1d040ff2c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzU4NjctOTc2NDRhMTMtYmQyZS00NzM0LTkwZmItNWRlMWQwNDBmZjJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1YzJmODBjY2UyMjVjOGQ0MjEyMGU2ZTJjY2ZhNDgyMDUzM2EwMTkwMzUyMTIwMWUyODQ2Mjg2OGM2YjUwOWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zghHr0_lc5YcHlzucoER23SPAYJf6T0u6hc4mzlCntY)
gambar 6. done upload to github
misalnya begini : saya sudah memperbarui kode saya seperti dibawah ini, secara otomatis visual studio code bisa mengenali perubahan yang terjadi
![image](https://private-user-images.githubusercontent.com/48278734/266475967-7db7701c-ad77-4fbc-ad11-0476910192e3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzU5NjctN2RiNzcwMWMtYWQ3Ny00ZmJjLWFkMTEtMDQ3NjkxMDE5MmUzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg4NDBiMzE1ZWM2ZGRjMjkzNTc5NmVkMGEzNDNhYjQzOGVjMTdlNTA0OTc1OTM0NzQzNzA5MWY3YjVkZGJlZDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GP-sOHb1Rqa7QgB-JpMW9DjZJ3YRtU3SjVliHHmo9Vg)
gambar 7. update code
selanjutnya silahkan klik saya pada tab source control tersebut, lalu anda bisa lakukan commit secara langsung
![image](https://private-user-images.githubusercontent.com/48278734/266476073-91531987-c748-48d1-b1d7-0d2eef386eed.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzYwNzMtOTE1MzE5ODctYzc0OC00OGQxLWIxZDctMGQyZWVmMzg2ZWVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ5YjAyZjY5ZTBhZjIzMjQyODY1ZjUwZDMxYTZkYmVmMTAzZjdiYTlmYzg0MDQwY2NkZjIxYjU0NDViZjk0ZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.DeqPslYkTkA3Oi5IBiq9FJEBhffkE27i7QxEZSxv-cE)
gambar 8. commit without write script
dan terakir lakukan push ke branch master
![image](https://private-user-images.githubusercontent.com/48278734/266476125-a889c47f-7bfb-43f9-befe-81ab3ddf9836.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwNDM1MzMsIm5iZiI6MTcyNDA0MzIzMywicGF0aCI6Ii80ODI3ODczNC8yNjY0NzYxMjUtYTg4OWM0N2YtN2JmYi00M2Y5LWJlZmUtODFhYjNkZGY5ODM2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDA0NTM1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwMDQzOWZiZTc2ZTM3N2ExY2YyZmNiNzI5NjY4OWQ5Nzc5YzUwNjJlNzA1YzE4MzdkMGMxNDI5ZDQ2MTg3MzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nh-3gDOOmdJtXkZcEJVkN7Wr5jZEmyQZzPgstiUGQss)
gambar 9. push to branch