配置文件

Git 配置

# 全局 name
git config --global user.name "John Doe"

# 全局 邮箱
git config --global user.email johndoe@example.com
ssh-keygen -t rsa -C "你的邮箱"
# 然后把 ~/.ssh/id_rsa.pub 这个文件添加到 github 的 SSH keys

Git 加速

# Windows
C:\Windows\System32\drivers\etc\hosts
# Linux
vim /etc/hosts
# 文本追加
199.232.69.194 github.global-ssl.fastly.net
140.82.112.4 github.com 
# Windows
C:\Users\luke\.ssh\config
# Linux
vim ~/.ssh/config
# 文本追加
Host github.com
    HostName github.com
    # 可能会导致git 无法使用,可以选择注释到这一行代理
    ProxyCommand connect -S 127.0.0.1:10808 %h %p
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa
# 刷新
# Windows
ipconfig /flushdns
# Linux
/etc/init.d/network restart

Git 上传本地项目

github上最好不存在任何文件包括readme,.gitignore

1、(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库

git init

2、把文件添加到版本库中,使用命令 git add .添加到暂存区里面去

git add .

3、用命令 git commit告诉Git,把文件提交到仓库。引号内为提交说明

git commit -m 'first commit'

4、关联到远程库

git remote add origin 你的远程库地址

如:

git remote add origin git@github.com:lukelmouse-github/xxx.git

5、获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败)

git pull --rebase origin master

rebase 用法

6、把本地库的内容推送到远程,使用 git push命令,实际上是把当前分支master推送到远程。

git push -u origin master

这种方法更通用,当远端没有 master 分支时,会自动创建一个 origin master 分支,然后进行关联

7、状态查询命令

git status

Git Book

Android

gradle 代理

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=10808

systemProp.socks.proxyHost=127.0.0.1
systemProp.socks.proxyPort=10808
posted @ 2022-05-06 10:04  南风--  阅读(37)  评论(0编辑  收藏  举报