git config --global user.name 'Your Name' git config --global user.email 'your@email.com' git config --global core.pager 'less -x3r' git config --global diff.tool 'vimdiff' git config --global diff.guitool 'gvimdiff' git config --global difftool.prompt 'false' git config --global http.sslverify 'false'
git diff-tree --no-commit-id --name-only -r commitid
git log --all -- path/to/file.ext
git reflog show --date=iso origin/master
git log --abbrev-commit --pretty=oneline 228d0ae de36d78 git log --pretty=oneline 228d0ae de36d78
git show d9ekhg9alk239d94dkd949dksc0dkgkls90fds93
git show d9ekhg9alk239d94dkd949dksc0dkgkls90fds93 | head -6
git show d9ekhg9alk239d94dkd949dksc0dkgkls90fds93 | grep "^diff --git"
git tag new old git tag -d old git push origin :refs/tags/old git push --tags
The colon in the push command removes the tag from the remote repository. If you don't do this, git will create the old tag on your machine when you pull.
Ensure that the other developers/users remove the deleted tag by running the following command:
git pull --prune --tags
git clone --mirror https://github.com/you/prj cd prj.git # HTTP URL http://gitlab.example.com/you/prj.git git remote add gitlab git@git.albertleadata.org:you/prj.git git push gitlab --mirror # Switch local clone to new repo: git remote remove origin git remote add origin git@git.albertleadata.org:you/prj.git git fetch --all
git remote add upstream https://github.com/whoever/whatever.git
git fetch upstream
git checkout master
git rebase upstream/master
Alternately, you could do a git merge upstream/master
, but a rebase is most sane, especially for keeping pull requests well-behaved
if [ "$refname" == "refs/heads/master" ]; then if [ "$USER" != "<someadminuser>" ]; then echo "POLICY: you are not allowed to change the master branch !" exit 1 else echo "POLICY: $USER allowed to change the master branch ..." fi fi
git config receive.denyCurrentBranch ignore
git symbolic-ref HEAD refs/heads/thebranch
apt install software-properties-common
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt install git-lfs
git lfs install
First (as root):
mkdir -p /var/www/git chown msamud1:apache /var/www/git chmod 2750 /var/www/git chcon -t httpd_sys_content_t /var/www/git
Then, create auth file with something like: htpasswd -c /var/www/git/.htpasswd git
… prompted for password
In /etc/httpd/conf.d/git.conf
:
# Git-smart HTTP/HTTPS back-end SetEnv GIT_PROJECT_ROOT /var/www/git SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ <Directory "/usr/libexec/git-core"> Options +ExecCGI Require all granted </Directory> <LocationMatch "^/git/.*/git-receive-pack$"> Order allow,deny Allow from all </LocationMatch>
In /etc/httpd/conf.d/git.conf
:
# Git-smart HTTP/HTTPS back-end SetEnv GIT_PROJECT_ROOT /var/www/git SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ <Directory "/usr/libexec/git-core"> Options +ExecCGI Require all granted </Directory> <LocationMatch "^/git/.*/git-receive-pack$"> Order allow,deny AuthType Basic AuthName "Git Access" AuthUserFile /var/www/git/.htpasswd Require valid-user # Require group committers </LocationMatch>
In /etc/httpd/conf.d/git.conf
:
# Git-smart HTTP/HTTPS back-end SetEnv GIT_PROJECT_ROOT /var/www/git SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ <Directory "/usr/libexec/git-core"> Options +ExecCGI Order deny,allow AuthType Basic AuthName "Private Git Access" AuthUserFile /var/www/git/.htpasswd Require valid-user </Directory>
Ensure mod_ldap
is installed, then in /etc/httpd/conf.d/git.conf
:
<Directory "/usr/libexec/git-core"> Options +ExecCGI Order deny,allow AuthType Basic AuthName "Private Git Access" AuthBasicProvider ldap AuthLDAPURL "ldap://cosmos.samudio.net/dc=samudio,dc=net?uid?sub?" Require valid-user </Directory>
AuthLDAPURL "ldap://ad-ldap-prod.uhc.com/dc=ms,dc=ds,dc=uhc,dc=com?sAMAccountName?sub?(objectCategory=person)(objectClass=user)"
<LocationMatch "^/git/yourrepo.*"> ... add same LDAP constructs, except for ... Require ldap-attribute sAMAccountName="yourlogin" </LocationMatch>
Links: Tech Info … Devops Info