git command

作者: lo0o | 来源:发表于2016-01-12 17:08 被阅读0次

1. 管理git ssh key

创建key pairs

ssh-keygen -t rsa -C "youremail@yourcompany.com"

~目录下会生成.ssh目录,包含id_rsa.pub和id_rsa两个文件

添加private key

ssh-add ~/.ssh/id_rsa

如果出现错误,可以先使用如下命令

ssh-agent bash

在profile settings->SSH Keys->Add SSH Key中添加id_rsa.pub中内容

然后进行连接,

ssh -T git@gitlab.yourdoman

成功会显示

Welcome to GitLab, xxx

如果出现提示SSL证书错误。如下

fatal: unable to access 'https://github.com/subying/jsbook.git/': SSL certificate problem: unable to get local issuer certificate

可以使用如下命令跳过SSL证书验证

git config --global http.sslVerify false

2. git push内容

将目录变成git管理的仓库

get init

添加origin

git remote add origin git@gitlab.{your domain}.git

如果git上内容比本地新,pull内容到本地

git pull origin master

添加或更新本地内容到git

git add {your file}

git commit -m "your commit"

git push origin master

替换本地改动

git checkout -- <filename>

相关文章

  • git 命令大全

    git help command # 显示command的helpgit show # 显示某次提交的内容 git...

  • Git Basic

    A simple command-line tutorial: Git global settings: git ...

  • 执行git pull时报错command 'git pu

    执行git pull时报错Exit status of command 'git pull && git fetc...

  • 新项目关联远程git仓库

    Command line instructions 1. Git global setup git config ...

  • Git常用命令&git merge心得

    Command line instructions Git global setup git config --g...

  • git command

    clone push pull if local version have changed, commit hav...

  • git command

    git提交和上传步骤 1. 初始化本地git仓库在本地项目根目录下,git init该命令在目录下生成.git文件...

  • git command

    git diff HEAD git status 命令git checkout -- readme.txt意思就是...

  • Git command

    版本切换 切换到某次提交的版本 git reset --hard commit_id 查看日志 查看日志 gi...

  • Git Command

    git init git remote add origin xxxxxxx@xxxx.git git pull ...

网友评论

    本文标题:git command

    本文链接:https://www.haomeiwen.com/subject/ojkckttx.html