git config

从头开始讲吧。

首先Github一般情况下是不容易访问的,由于已知原因访问速度极慢,所以一般我们使用代理来访问,本地的git库也同理。但是可能是我机场的问题,我无法通过ssh来push我的代码,因为22号端口被ban掉了,所以我就只能通过https来上传我的代码。

一开始我是在Mac上上传我的代码。在Mac上生成gpg的一个key之后按要求上传上去之后好像就可以正常通过https push代码了,当时也没详细研究,我也对https这部分内容不熟,所以就没怎么在意。

这两天我又把我的Arch Linux装了回来,我想讲其也作为我的一个push代码的设备(主要是整理一些linux下的config文件,以及打算试试自己配dwm)。之后就遇到“究竟如何让git push代码上去”这个问题。

同时我也又回顾了一下Mac下我是怎么做的,才发现Xcode帮助我解决了一些问题,所以我才能正常使用https的git push。

git clone

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
git submodule init 
git submodule update
git submodule deinit --all

git rebase
git checkout

git reset --hard
git reset --soft

git cherrypick
git chechout

git branch -a # 查看所有分支
git branch -d <branch_name> # 删除分支

GitHub through proxy

Using SSH over the HTTPS port

背景:使用git上传GitHub一般需要科学上网。如果直接使用ssh的登陆方式可能会被代理服务器拒绝,因为ssh要访问22号端口。