$ git clone https://github.com/tomfriwel/programming-notes.git
$ git pull origin master --allow-unrelated-histories
$ git checkout -b iss53
$ git rm -r --cached folder/*
$ git remote remove origin
-r means recursively
$ git reset --soft HEAD^
$ git push -d <remote_name> <branch_name>
$ git branch -d <branch_name>
$ git rm --cached [file name] -r
$ git remote set-url origin git://new.url.here
$ git remote set-url origin <URL>
$ git remote set-url origin --push --add <a remote>
$ git remote set-url origin --push --add <another remote>
pull/push from multiple remote locations
git@gitlab.com: Permission denied (publickey).
$ ssh -v git@github.com
$ more ~/.ssh/id_rsa.pub
使用git push origin master向github推送代码,出现git@github.com: Permission denied (publickey).
Error Details:
Git: Connection to gitlab.com closed by remote host.
Bad packet length xxx.
ssh_dispatch_run_fatal: Connection to <IP> port 22: message authentication code incorrect
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Solution:
Add <IP> gitlab.com to /etc/hosts
Test: $ ssh -T git@gitlab.com
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
git push 时出现Connection closed by remote host
$ git ls-files --debug
This command will outputs something like below:
...
afilepath
ctime: 1587888319:776648808
mtime: 1587888319:776648808
dev: 16777220 ino: 73196524
uid: 501 gid: 20
size: 1227 flags: 0
...
$ git reset HEAD~1 keep changes
$ git reset --hard commit_id will lose changes, use $ git log to view commits histroy and find the commit_id, which you want to reset to.
$ git reset --soft HEAD~1
git config --get http.postBuffer
git config http.postBuffer 524288000
git config --global http.postBuffer 524288000git clone error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 http.postBuffer
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 #7025
ssh-keygen -t rsa -b 4096 -C xxx@xx.com
eval "$(ssh-agent -s)"
open ~/.ssh/configHost *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
ssh-add -K ~/.ssh/id_ed25519
# add to github
pbcopy < ~/.ssh/id_ed25519.pub
$ brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
Updating Homebrew...
==> Tapping adoptopenjdk/openjdk
Cloning into '/usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk'...
fatal: unable to access 'https://github.com/adoptopenjdk/homebrew-openjdk/': Could not resolve proxy: proxiURL
Error: Failure while executing; `git clone https://github.com/adoptopenjdk/homebrew-openjdk /usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk` exited with 128.$ git config --global http.proxyAuthMethod 'basic'
$ git config --system --unset credential.helper
$ git push --force origin master
~/.gitconfig
git config --global --list
$ git log -p <file path> | grep <content of searching>
touch test.sh
vi test.sh
chmod +x test.sh
# check changes file
git fetch
git diff --name-only origin/master..master
# set usernmae, passwork cache time
git config --list
格式git clone http://userName:password@链接地址
实例git clone https://用户名:密码@git.coding.net/sample/HelloWorld.git
作者:Yvanna_15
链接:https://www.jianshu.com/p/d29c40145912
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
# 好像没用
git config --global credential.helper 'cache --timeout=360000'
git config --global credential.helper cache
git config --global credential.helper store> git pull --tags origin master
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: couldn't find remote ref masterfix by: $ git push origin master:master