Installation RHEL 9.0 and Fedora 35
$ sudo dnf install git
Configuration
$ git config --global --add user.email "you@example.com"
$ git config --global --add user.name "Username"
# Cache for 1 hour
git config --global credential.helper "cache --timeout=3600"
# Cache for 1 day
git config --global credential.helper "cache --timeout=86400"
# Cache for 1 week
git config --global credential.helper "cache --timeout=604800"
$ git config --global -l
user.email="you@example.com"
user.name="Username"
credential.helper=cache
$ git config --global --unset user.email
$ git config --global --unset user.name
$ git config --global --unset credential.helper
Working with github.com
github has disabled basic authentiction (username and password) and now requires login with OAuth access tokens.
https://github.com/settings/tokens
"Personal access tokens function like ordinary OAuth access tokens. They can be used instead of a password for Git over HTTPS, or can be used to authenticate to the API over Basic Authentication."
You use these tokens as normal password when logging in.
$ git clone https://github.com/magnuskkarlsson/DO180-apps.git
$ cd DO180-apps/
$ git status
Create local branch and pushing it to remote.
$ git checkout -b branch_delete
$ git push -u origin branch_delete
username for 'https://github.com': <"Username">
Password for 'https://you@github.com': <Your Personal Access Token>
$ git branch -a
Delete local branch and delete remote branch.
$ git checkout master
$ git branch -d branch_delete
$ git push origin --delete branch_delete
You cannot delete a file in git, you need to delete it ('git rm') and commit and push the delete.
$ touch FOO
$ git add FOO
$ git commit -m "added FOO"
$ git push -u origin master
$ git rm FOO
$ git add .
$ git commit -m "deleted FOO"
$ git push -u origin master
No comments:
Post a Comment