本地上传
要将本地代码库上传到GitHub上已经存在的repo上,需要push之前先pull并合并,但是不能简单git pull指令,需要git pull origin master --allow-unrelated-histories
,然后再git push
撤销操作
git checkout 还原工作区内容,即暂存区内容覆盖工作区内容
git reset 还原暂存区内容,即撤销 git add操作
git clean 删除工作区中没有被git跟踪的文件
git revert 删除一些已提交的历史文件,当然会用新的覆盖旧的密码缓存
git config --global credential.helper store
命令将登陆信息储存在本地,以此避免重复输入密码的麻烦,但会造成一定安全隐患。启用 credential.helper store 会将密码以明文方式存储在.gitconfig文件同目录下的.git-credentials中。
设置git代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
git config --global http.sslVerify false
配置shadowsocks
配置/etc/shadowsocks/config.json:
{
"server":"my_server_ip",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"mypassword",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false,
"workers": 1
}启动server
sudo ssserver -c /etc/shadowsocks/config.json
- 连接server
sslocal -s 127.0.0.1 -p 8388 -l 1080 -k mypassword -m aes-256-cfb