🚀Step to push the new file to remote from local.
➡️ Create a new repository in a GitHub
We have created a new repository named Tws-practice-devops.
Keeping the repository Public and adding a readme file and done.
➡️Clone to local and add a file.
Cloned the repo using the git clone <repositry_url>
. It creates a copy of the repository locally and then added the command.txt
with some commands in it. Now we have to push the changes to the remote for that we have to set url.
➡️Set URL for the push
To set the URL the command used is git remote set-url --add origin <repository_name>
. Here the repository name also includes the token which is generated using Git Hub to access the push from the local.
➡️Remove the previous URL
Remove the old URL by using the following command.
git remote set-url --delete origin <old_url>
.
➡️Git push
Finally, we are now ready to push the changes to the remote by using git push origin <branch_name>
.
Hence, we can see the changes reflected on the remote repository.