使用gitlab
(1)删除已有的公钥

使用命令:ssh-keygen.exe
私钥默认路径:/c/users/admin/.ssh/id_rsa
执行结果:
$ ssh-keygen.exe
generating public/private rsa key pair.
enter file in which to save the key (/c/users/admin/.ssh/id_rsa):
enter passphrase (empty for no passphrase):
enter same passphrase again:
your identification has been saved in /c/users/admin/.ssh/id_rsa.
your public key has been saved in /c/users/admin/.ssh/id_rsa.pub.
the key fingerprint is:
31:87:7e:23:33:8f:70:61:c9:29:66:a4:7e:2c:db:98 admin@admin-pc
the key's randomart image is:
+--[ rsa 2048]----+
| . |
| o . + |
| . + x . |
| . + + = |
| o + s o |
| b o b . |
| e . . . |
| |
+-----------------+
生成的公私玥:
其中,id_rsa.pub 是公钥,需要拷贝id_rsa.pub内容到github中
把上述内容拷贝到github中,如下图
注意:内容后面不能有空格和换行.
添加成功:
这样就可以使用git bash直接clone 代码库勒.
使用命令:git clone [email protected]:aaa/bb_web.git
查看分支:
git branch -r
检出指定分支
git checkout origin/dev_revert_online
提交修改的文件(commit)
第一次提交时失败
解决方法:
先执行:git config --global user.email "[email protected]"
然后就提交成功了
查看最后一个commit了的文件
git log -n 1
提交流程
git add index.html
git commit -m "test" *
git push
$ git checkout
your branch is up-to-date with 'origin/master-bug'.