Create a new repository on the command line
echo "# Github" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/username/Repository.git
git push origin main
Push an existing repository from the command line
git remote add origin https://github.com/username/Repository.git
git branch -M main
git push origin main
When creating a file and then uploading to Github
create file.txt
git add -A | git add file.txt
git commit -m "message"
git push origin main
- Create token classic at your settings
- Grab and copy de Token
- Install GCM - Github credential manager
Linux deb package (ubuntu):sudo dpkg -i <path-to-package>
- Run the following command:
git config --global credential.helper store
- When doing
git push origin main
enter your credentials:Username for 'https://github.com': username at github.com Password for 'https://[email protected]': [Paste the Token]
- Your credentials now are stored in the system
- Repeat
git push origin main
, and credentials will be not required now on.