How to start working in GitHub: A beginner guide
If you are starting a new project and never used GitHub, then this post is for you. I have used Ubuntu for my local pc.
GitHub provides a great opportunity to keep track of a project and helps to store the project contents. I am using GitHub for each project as a development tool. The main purpose of using GitHub to store or update every line of code from my local pc to the server without paying any fees.
Step 1: Create a GitHub account using https://github.com/.
Step 2: Log in to your GitHub account.
Step 3: Create a new repository by clicking the button named ‘new’. Then you need to provide a repository name. You can also provide a description that is optional. You need to select whether your repository is visible to Public or Private. I usually make my repository private during the development phase. Then click the Create repository button.
Step 4: After creating the GitHub repository, Next, we need to connect this repository to the local pc. Open the terminal (if you are using windows then download gitbash, https://gitforwindows.org/).
Step 5: Go to the folder location in your terminal using the cd command and add your files. Next, type the following commands:
git config --global user.name your-GitHub-account-user-name
git config --global user.email your-GitHub-account-user-email
git init
git add --all
git commit -m “write your message”
Now you need to copy the repository link (see the screenshot below).
Type the following command with your copied link
git remote add origin your-github-repository-link
git push origin master
If you have no files in your local folder, then you may see the following error message:
If you see this error, then change the command from your previous steps: git commit -m “write your message” as
git commit -m “write your message” --allow-empty
Next, it will ask for your GitHub user name and password. Provide this information and enter. Your local file will be uploaded to the GitHub server.
Now if you change or update any files in your selected local folder, you need to type the following commands to update the GitHub server files.
git stage -A
git commit -m “your message”
git push origin master
It will ask for your GitHub user name and password. Provide this information and enter. Congratulations! I hope GitHub will be your backup tools for the next project.