Today, let's learn how to get started with github from scratch π€.
Run the command in your ubuntu terminal.
sudo apt-get install git
Open github account from your browser. Sign in. Create a new repo.
Copy the https url.
Ex:(https://github.com/<user-name>/<repo-name>.git)
Go to the directory in which the file/folder that you wish to upload is located.
Run git init
Run git remote add origin <url(one you copied)>
This command creates a new connection to your repo.
"origin" is the name of the connection established.
You can also change the name of the connection to anything you want. Suppose I like cricket, so I may add
git remote add cricket <link to repo>
To check established connections(fetch/push). We can use git remote -v
Now, you can add files to stage. They will reflect in your status later. You can do it by git add <file-name>. To add multiple files, git add <file1> <file2> ... <filen>.
Confirm your changes with git status command.
Commit changes git commit -m "<your commit msg>"
Push commits git push origin master
Enter your github username, as asked in the prompt
Enter your github password (βΒ΄β‘`β).
Well! As guessed, it doesn't work...
Now, as github stopped accepting passwords, we need to use Personal Access Token(PAN) as password.
To get your PAN, go to github account > Settings > Developer Settings > PAN > Tokens(Classic) > Generate new token > (Give a note. Allow all applicable checks that you need with a desired expiration period)> Click on generate token.
Copy your π³. Use it as your password for future as well.

Top comments (0)