建立github本地仓库与远程仓库

xiaoxiao2021-02-28  62

 1.创建自己的github账号 https://github.com/ 2.在ubuntu下安装git sudo apt-get install git 3.创建本地仓库 mkdir learngit cd learngit git init 4.把文件添加到仓库 添加:git add xxx #xxx可以是文件或者文件夹(非空) 提交:git commit -m "wrote a readme file" #-m及之后是上传说明 5.创建远程仓库 添加公钥  ssh-keygen -t rsa -C " youremail@example.com"  复制~/.ssh/id_rsa.pub文件里的全部内容***-登录github-右上角图标-settings-SSH and GPG keys-主题随便写-内容粘贴*** https://github.com/---start a project--Repository name填入learngit,其他保持默认设置 关联远程仓库:git remote add origin git@github.com:'github账户名'/learngit.git 删除关联的远程仓库git remote remove origin 6.添加文件到远程仓库 git push -u origin master #当你第一次使用Git的clone或者push命令连接GitHub时,会得到一个警告: #The authenticity of host 'github.com (xx.xx.xx.xx)' can't be established. #RSA key fingerprint is xx.xx.xx.xx.xx. #Are you sure you want to continue connecting (yes/no)? #这是因为Git使用SSH连接,而SSH连接在第一次验证GitHub服务器的Key时,需要你确认GitHub的Key的指纹信息是否真的来自GitHub的#服务器,输入yes回车即可。 #此后,每次本地提交后,只要有必要,就可以使用命令git push origin master推送最新修改
转载请注明原文地址: https://www.6miu.com/read-250132.html

最新回复(0)