GIT命令

忽略本地修改

git checkout .

 

我需要放弃本地的修改,用远程的库的内容就可以,应该如何做?傻傻地办法就是用心的目录重新clone一个,正确的做法是什么?

正确的做法应该是:

git fetch --all
git reset --hard origin/master

 

ssh keys 生成和 多个并存

首先在对应的宿主机上创建秘钥

ssh-keygen -t rsa -b 2048 -C "email@example.com"

要注意文件名要制定的文件名

在~/.ssh/config 文件 ~/.ssh/id_rsa_gitlab

 

Host gitlab.dpdp.fun
    HostName gitlab.dpdp.fun
    PreferredAuthentications publickey
        IdentityFile ~/.ssh/id_rsa_gitlab
        User root

如果搭建的gitlab ssh 对应端口为外网自定义端口

git clone ssh://git@gitlab.dpdp.fun:8822/root/helloworld.git