Difference between revisions of "IT-SDK-Git"
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
* https://help.github.com/en/github/using-git | * https://help.github.com/en/github/using-git | ||
* https://www.atlassian.com/git/tutorials/setting-up-a-repository | * https://www.atlassian.com/git/tutorials/setting-up-a-repository | ||
| − | + | =ssh= | |
<pre class="code"> | <pre class="code"> | ||
type %userprofile%\.ssh\id_rsa.pub | clip | type %userprofile%\.ssh\id_rsa.pub | clip | ||
cat %userprofile%\.ssh\id_rsa.pub | clip | cat %userprofile%\.ssh\id_rsa.pub | clip | ||
</pre> | </pre> | ||
| − | = | + | |
| + | =Settings= | ||
<pre class="code"> | <pre class="code"> | ||
git config --global user.name "Samer Hijazi" | git config --global user.name "Samer Hijazi" | ||
git config --global user.email "samer.hijazi@samerhijazi.net" | git config --global user.email "samer.hijazi@samerhijazi.net" | ||
... | ... | ||
| + | git config http.receivepack true | ||
| + | git update-server-info | ||
| + | </pre> | ||
| + | =Credential Storage= | ||
| + | - default: no cache at all | ||
| + | - cache: keeps credentials in memory for a certain period of time. | ||
| + | - store: saves the credentials to a plain-text file on disk. | ||
| + | - Mac-Chain: in Mac caches credentials in the secure keychain "osxkeychain". | ||
| + | - Windows-Chain: in Windows caches credentials in the secure keychain. | ||
| + | <pre class="code"> | ||
git config --global credential.helper cache | git config --global credential.helper cache | ||
| + | git config --global credential.helper 'store --file ~/.my-credentials' | ||
git config --global credential.helper manager | git config --global credential.helper manager | ||
git config --global credential.helper wincred | git config --global credential.helper wincred | ||
| Line 18: | Line 30: | ||
... | ... | ||
git credential-manager version | git credential-manager version | ||
| − | |||
| − | |||
</pre> | </pre> | ||
| − | + | =init= | |
| − | |||
<pre class="code"> | <pre class="code"> | ||
git --bare init # Initial Repo for remote | git --bare init # Initial Repo for remote | ||
| Line 29: | Line 38: | ||
git remote add origin https://samerhijazi@gitlab.com/samerhijazi/public.git | git remote add origin https://samerhijazi@gitlab.com/samerhijazi/public.git | ||
</pre> | </pre> | ||
| − | + | =Workflow= | |
<pre class="code"> | <pre class="code"> | ||
git clone ssh://ssh-w0000000@servername.com/www/htdocs/w0000000/repository/git/projectname.git | git clone ssh://ssh-w0000000@servername.com/www/htdocs/w0000000/repository/git/projectname.git | ||
| + | git pull | ||
git add README.md | git add README.md | ||
git commit -m "First commit" | git commit -m "First commit" | ||
git push -u origin master | git push -u origin master | ||
</pre> | </pre> | ||
| − | + | =Branching= | |
<pre class="code"> | <pre class="code"> | ||
git branch -m feature1 feature2 # To rename a local Git branch | git branch -m feature1 feature2 # To rename a local Git branch | ||
git push -u origin feature2:feature3 # To rename a remote Git branch | git push -u origin feature2:feature3 # To rename a remote Git branch | ||
</pre> | </pre> | ||
Revision as of 17:56, 16 December 2019
Resource
- https://help.github.com/en/github/using-git
- https://www.atlassian.com/git/tutorials/setting-up-a-repository
ssh
type %userprofile%\.ssh\id_rsa.pub | clip cat %userprofile%\.ssh\id_rsa.pub | clip
Settings
git config --global user.name "Samer Hijazi" git config --global user.email "samer.hijazi@samerhijazi.net" ... git config http.receivepack true git update-server-info
Credential Storage
- default: no cache at all - cache: keeps credentials in memory for a certain period of time. - store: saves the credentials to a plain-text file on disk. - Mac-Chain: in Mac caches credentials in the secure keychain "osxkeychain". - Windows-Chain: in Windows caches credentials in the secure keychain.
git config --global credential.helper cache git config --global credential.helper 'store --file ~/.my-credentials' git config --global credential.helper manager git config --global credential.helper wincred git config --global --edit ... git credential-manager version
init
git --bare init # Initial Repo for remote ... git init # Initial Repo for local git remote add origin https://samerhijazi@gitlab.com/samerhijazi/public.git
Workflow
git clone ssh://ssh-w0000000@servername.com/www/htdocs/w0000000/repository/git/projectname.git git pull git add README.md git commit -m "First commit" git push -u origin master
Branching
git branch -m feature1 feature2 # To rename a local Git branch git push -u origin feature2:feature3 # To rename a remote Git branch