DEV Community

Shawon Saha
Shawon Saha

Posted on

Upload your existing project to github from your linux machine

In this guide I am going to upload my existing project from my linux machine's terminal to github.

Initiate Git

Open terminal and navigate to your project's directory.

git init
Enter fullscreen mode Exit fullscreen mode

Configure your username and email

git config --global user.name "your_github_username"
git config --global user.email "your_github_email"
git config -l
Enter fullscreen mode Exit fullscreen mode

Create an empty repository on Github

New Repository

Creating a repository

Copy the https link of that repository

HTTPS git url

Add remote origin

git remote add origin https://github.com/username/repo-name.git
Enter fullscreen mode Exit fullscreen mode

Add all files into stage and commit with commit message

git add .
git commit -m "Initial Commit"
Enter fullscreen mode Exit fullscreen mode

Now push to github

git push origin master
Enter fullscreen mode Exit fullscreen mode

Generate Access Token

Before entering your password Go to Settings > Developer settings > Personal access tokens > Tokens (Classic) > Generate new token (classic) > Mark repo and add a note > Hit Generate Token > Copy the Token
Access token generation

Paste your token into password

Github access token

Cache the record locally to remember the token:

git config --global credential.helper cache
Enter fullscreen mode Exit fullscreen mode

Verify

git pull -v
Enter fullscreen mode Exit fullscreen mode

Source: StackOverflow

Top comments (0)