File README.md added (mode: 100644) (index 0000000..eea4a10) |
|
1 |
|
################################### |
|
2 |
|
创建仓库后先设置admin: |
|
3 |
|
Edit Repo rights Refs rights Path rights Delete Lock |
|
4 |
|
编辑 回购权 参考资料权利 道路权 删除 锁定 |
|
5 |
|
edit编辑,名随便 下边随便 建立。 |
|
6 |
|
Repo rights在设置授予回购权:用户使用“自己用户”全部。 |
|
7 |
|
Refs rights重要:裁判权:用户使用“*”全部. |
|
8 |
|
Path rights路径:用户使用“*”全部. |
|
9 |
|
|
|
10 |
|
在主页设置ssh密钥,在设置 登录令牌。(已有仓库设置过就不用设置了) |
|
11 |
|
################################### |
|
12 |
|
在项目上打开自己的 Git Bash Here ,然后输入git config --system --unset credential.helper,退出之后重新拉取项目 |
|
13 |
|
执行命令之后,再次pull或push时会缓存输入的用户名和密码: |
|
14 |
|
git config --global credential.helper store |
|
15 |
|
################################### |
|
16 |
|
################################################ |
|
17 |
|
#git pull --rebase origin main#先取消掉本地库中刚刚的commit,在pull合并代码设置。然后再进行push即可 |
|
18 |
|
###################################成功 |
|
19 |
|
清除git缓存中的用户名的密码 |
|
20 |
|
git credential-manager uninstall |
|
21 |
|
在第一次提交之前,不要忘记设置你的 git 环境: |
|
22 |
|
git config --global user.name "xxx" |
|
23 |
|
git config --global user.email "xxx@qq.com" |
|
24 |
|
ssh-keygen -t rsa -C xxx@qq.com |
|
25 |
|
cat ~/.ssh/id_rsa.pub |
|
26 |
|
################################### |
|
27 |
|
如果您本地没有该项目,并且想要克隆它:克隆 转到 创建分支 |
|
28 |
|
git clone https://rocketgit.com/user/dongge/admin admin && cd admin && git checkout -b main |
|
29 |
|
|
|
30 |
|
#git init --initial-branch main --object-format sha1 |
|
31 |
|
#git reset --hard d32d7c49af9203f3ebc414d5f73a38c00b0d4c13 #彻底删除版本库git reset --hard ca7719755e77a7c30500d7d1854c255769e13322 |
|
32 |
|
#git rm -r --cached . ##git checkout HEAD~1#取消上2次提交git reset HEAD~2#转到git checkout main# |
|
33 |
|
|
|
34 |
|
|
|
35 |
|
git add . && git commit -m 'xxxx' --no-verify && git push origin main |
|
36 |
|
git remote add origin https://rocketgit.com/user/dongge/m2 |
|
37 |
|
|
|
38 |
|
################################### |
|
39 |
|
#git checkout -b main #创建分支改为远程的main#git branch -m 旧名称 新名称:git branch -m master main##转到分支git checkout main |
|
40 |
|
#输入用户名dongge 二次验证密钥 git push -uf origin main:18#强制覆盖上传 |
|
41 |
|
git push origin master## git push -u origin main ## git push -uf origin master:main ##git push -u origin master:master |
|
42 |
|
git push origin master ##git push -u origin master ###git push origin main:master ###git push -f就可以强制推送 |
|
43 |
|
git push -f origin main ## git push -u origin master -f #强制覆盖原有的分支git push -uf origin master |
|
44 |
|
|
|
45 |
|
删除远程分支:git push origin --delete master |
|
46 |
|
################################### |
|
47 |
|
git pull --rebase origin master#push后,在pull合并同步代码设置。然后再进行下一次push即可 |
|
48 |
|
|
|
49 |
|
########################################################## |
|
50 |
|
官方推送步骤: |
|
51 |
|
##git status 删除未推送缓存里的文件如: git rm --cache m/lib/fan.txt |
|
52 |
|
|
|
53 |
|
git pull --rebase origin main#代码和并 |
|
54 |
|
git commit --amend -m 'OCT: 删除无用变量代码' |
|
55 |
|
git remote rm origin ##先删除远程 Git 仓库 |
|
56 |
|
git remote add origin https://rocketgit.com/user/dongge/m1 |
|
57 |
|
######################################################### |
|
58 |
|
git branch -a |
|
59 |
|
获取所有的列表,然后切换到需要删除的分支:git checkout main |
|
60 |
|
最后删除该分支:git push origin --delete main |
|
61 |
|
git撤销合并错误分支 |
|
62 |
|
方法1. git reset -hard commit_id |
|
63 |
|
方法2. gitrevert-m 1 branch_name reset: |
|
64 |
|
克隆指定分支:git clone -b 分支名称 http://xxxxxxx.git |
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
|
删除远程分支aaaa |
|
69 |
|
我比较喜欢的简单方式,推送一个空分支到远程分支,其实就相当于删除远程分支: |
|
70 |
|
$ git push origin :aaaaaa |
|
71 |
|
也可以使用: |
|
72 |
|
$ git push origin --delete aaaaaa |
|
73 |
|
######################################################## |
|
74 |
|
命令行 Git 客户端不会立即记住您的凭据。确保您运行的是 Git 版本 1.7.12.1 或更高版本,然后使用以下命令启用密码缓存: |
|
75 |
|
git config --global credential.helper cache |
|
76 |
|
这将使 git 在您输入凭据后 15 分钟内记住您的凭据。要增加该限制,请使用以下命令并指定时间(以秒为单位): |
|
77 |
|
|
|
78 |
|
git config --global credential.helper 'cache --timeout=3600' |
|
79 |
|
|
|
80 |
|
################################### |