您的位置:首页 > 编程语言

github上传项目 出现错误后的…

2017-10-25 17:09 281 查看
成功之后,我们就可以在git终端上,测试连接后,如果一切没问题的话,连接可以通讯,执行命令如下: 

ssh –t
git@github.com 


 

7,然后在git里面,进入我们的仓库Demo更目录下 

执行命令: 

git remote add origin
git@github.com:qindongliang/Demo.git 

git push -u origin master 



在初始化版本库之前,先要确认认证的公钥是否正确,如下:

  ssh -T git@github.com


  正确地结果如下: 

  Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
  Hi findingsea! You've successfully authenticated, but GitHub does not provide shell access.


  会有一个Warning,不用理会。

  接下对库进行clone,如下:

  git clone https://github.com/findingsea/myRepoForBlog.git


  上面的地址可以在如下界面找到:

  


  clone成功如下:

  Cloning into 'myRepoForBlog'...
  Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
  remote: Counting objects: 3, done.
  remote: Total 3 (delta 0), reused 0 (delta 0)
  Receiving objects: 100% (3/3), done.


  【第三步】上传README.md文件

  这个时候,我们的GitHub文件夹下就多了一个myRepoForBlog文件夹,进入文件夹目录,对仓库进行初始化,如果我们之前没有勾选创建README,则要先创建README.md文件,不然上传文件会报错。如果在第一步就勾选过了

,则可以直接进入第四步



git init
  touch README.md
  git add README.md
  git commit -m 'first_commit'
  git remote add origin https://github.com/findingsea/myRepoForBlog.git   git push origin master


  【第四步】push文件

  创建完README.md后,就可以push了,代码类似。

  git add .
  git commit -m 'first_commit'
  git remote add origin https://github.com/findingsea/myRepoForBlog.git   git push origin master


  如果执行git remote add
origin https://github.com/findingsea/myRepoForBlog.git,出现错误:
  fatal: remote origin already exists


  则执行以下语句:

  git remote rm origin




再往后执行git remote add
origin https://github.com/findingsea/myRepoForBlog.git 即可。

  在执行git push
origin master时,报错:

  error:failed to push som refs to.......


 

  则执行以下语句:

  git pull origin master


  先把远程服务器github上面的文件拉先来,再push 上去。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐