How to upload files in Github/ Gitlab with CLI
- First Install Git Bash in your system. you can install from this link Git Bash
First, move to that directory from which you have to upload files.
example: I have to upload my upload.txt from Example/nipun folder at desktop so I will first go at path and directory.
Now I will execute commands.
$git init //for git initialize
$git add . //this will add our files in .git folder
$git commit -m “Nipun” // short message
$git remote add origin <Your repository URL>
$git push origin master
If you are facing error in upload files then execute this command
$git push -f origin master //-f for forcefully updating
👆 If you will do this then all the files will be deleted and then only single will upload
All the commands are the same for upload files in GitLab just change your URL example : 👇👇
at this:
$git remote add origin <Your repository URL> //gitlab / github URL
Let’s check :
🎊🎉We have successfully uploaded the file in GitHub 🎊🎉
If you have any query fill free to ask at nipun.parekh7@gmail.com