DEV Community

Cover image for GIT for newbie (PART 1)
ARUN KRISHNAN K
ARUN KRISHNAN K

Posted on

GIT for newbie (PART 1)

HOW TO ADD ANY FILES INTO HOSTING PLATFORMS (GitHub,GitLab,etc)

About this article

This article show us how to add your program file into hosting platform like GitHub, GitLab, etc. We do this by using git version control tool. Git tool is different from GitHub and GitLab.

Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different computers).

Follow the following steps to upload your file into hosting platforms.

  1. First of all download git from here. Git is inbuilt software for Linux, to conform that type git --version in terminal.

  2. Open the git bash on your windows, mac and type git --version to conform that git downloaded successfully. I will use the word terminal, for windows and mac users it same as git bash.

  3. Choose your file (the file you want to upload) by typing cd file_name, dir. cd file_name for choose folder and dir for showing all files in current folder. This command varies with OS.

  4. Type git init for add local git file (.git) into your system. You can locate this file by entering into the folder that you located early and turn on hidden files. You can see a .git file in this folder.

  5. Make necessary edit in the programming file and type in terminal git status to conform file edited successfully and follow below commands.

  6. git add — all for choose all the coded file.
    git commit -m “new file added” for locally save the code with a message.

  7. git remote
    git remote add origin https://github.com/ARUNKRISH11/Sample
    Adding git repo link (for each project first time only need this line of command). The link will get by creating new repository in GitHub or GitLab. For creating new repository in GitHub follow the instructions in the below image named 'Create new repository in your GitHub.'

  8. To see the remote name and link used previously use git remote or git remote -v

  9. git push origin master to uploading the file into your GitHub repository.

  10. After that you need to enter hosting platform username and token ID “ARUNKRISH11, ghp_G3cketo8dqEKrp6ubZh3h5GYs5vClDF”
    You can generate token id in GitHub by follow the instructions in the below image named 'Create new repository in your GitHub'

All commands used in this post

git --version
cd file_name
dir
git init
git status
git add --all
git commit -m "new file added"
git remote
git remote add origin https://github.com/ARUNKRISH11/Sample
git push origin master
Enter fullscreen mode Exit fullscreen mode

Steps done in terminal or git bash
Steps done in terminal or git bash
Create new repository in your GitHub.
Create new repository in your GitHub.
Generate GitHub personal access token ID
Generate GitHub personal access token ID

Thank you for taking the time to read through this Git explanation post! I hope it has clarified some of the key concepts and features of Git for you. Whether you're a beginner just starting out or an experienced developer looking to brush up on your skills, Git is an invaluable tool for version control and collaboration.

A big shoutout to the awesome developer community here for always fostering an environment of learning and growth. Your questions, feedback, and contributions are what make this community so special.

Feel free to share your thoughts, ask questions, or provide additional tips in the comments below. Let's keep the conversation going and continue to learn from each other!

Happy coding! 🚀

Top comments (1)

Collapse
 
arunkrish11 profile image
ARUN KRISHNAN K

Feel free to share your thoughts, ask questions, or provide additional tips in the comments below. Let's keep the conversation going and continue to learn from each other!

Happy coding! 🚀