GIT

作者: 晚安多巴胺 | 来源:发表于2017-11-02 16:18 被阅读0次

    一些常用的语句

    1、git add a.txt ----添加一个叫a的文本到暂存区
    git add . ----用点代表所有工作区的东西

    2、git commit a.txt -m "add some remarks"----将添加到暂存区的a文本加到本地仓库
    git commit -m "coments" ----commit 不写具体的文件就是所有add的内容

    3、git push origin master ----加本地仓库的东西上传到Gitee 或者Github

    4、fetch与pull有什么区别呢
    fetch就是取
    pull是fetch+merge

    5、clone +ssh一大坨
    6、要是想要再和那个远程仓库有什么瓜葛的话,还是要和做公钥什么的,参考下面problem3

    遇到了一些问题

    ?problem1
    git pull
    
    fatal: No remote repository specified.  Please, specify either a URL or a
    
    remote name from which new revisions should be fetched.
    
    solve1

    将.git里面的config里面换成下面的内容,URL和pushurl自己调整

    [core]  
            repositoryformatversion = 0  
            filemode = true  
            bare = false  
            logallrefupdates = true  
            ignorecase = true  
            precomposeunicode = false  
    [remote "origin"]  
            url = git@gitee.com:wuliTao12138/checkfrank.github.io.git  
            fetch = +refs/heads/*:refs/remotes/origin/*  
            pushurl = git@gitee.com:wuliTao12138/checkfrank.github.io.git  
    [branch "master"]  
            remote = origin  
            merge = refs/heads/master  
    
    ?problem2
    git commit 报 
    "Changes not staged for commit:"是怎么回事?
    
    solve2

    你add了吗!

    ?problem3
    git "Could not read from remote repository.Please make sure you have the correct access rights."
    
    solve3

    这是前面使用SSH url克隆的结果,需要在克隆之前先配置和添加好SSH key,具体操作如下

    2、ssh-keygen -t rsa -C "你的email地址"
    
    4、将生成的key放到码云或者github上生成public key
    5、ssh -T git@gitee.com(码云)输入ssh -T git@github.com(github)
    返回Welcome to Gitee.com, yourname!就好了
    

    toodo就写了一些就简单的,后面有时间可以完善一下

    ?problem4、
    git commit -aGetting fatal: Unable to create '/Users/justin/Sites/myapp/.git/index.lock': File exists.
    If no other git process is currently running, this probably means agit process crashed in this repository earlier. Make sure no other gitprocess is running and remove the file manually to continue.
    
    solve4、
    在.idea下面找到index.lock 删除即可
    
    problem-5
    Updates were rejected because the remote contains work that you do not have locally
    
    solve-5

    这是因为仓库里有你没有的东西
    1、先拉下来,会自动合并的(不用操心)

    git pull origin master

    2、再上传

    git push -u origin master

    problem-6

    EQ二连

    solve-6

    git branch --set-upstream dev origin/dev
    git branch --set-upstream-to origin/dev

    problem-7

    fatal: Authentication failed for 'https://gitee.com/wuliTao12138/practise.git/'

    solve-7

    输入登陆
    Username for 'https://gitee.com': “这里是登陆码云的账号,是邮箱就写邮箱”

    相关文章

      网友评论

          本文标题:GIT

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