美文网首页
git 上传本地项目到github

git 上传本地项目到github

作者: _鱼 | 来源:发表于2017-07-16 18:21 被阅读0次

1、设置用户名

git config --global user.name xxx

2、添加到本地

git init //初始化本地仓储

git add . //添加所有文件到本地仓储

git commit -m "feat:add"  //提交到本地

3、在github上创建仓储

4、生成密钥

打开Git Shell 输入如下命令:ssh-keygen -C "your@email.address" -t rsa

密钥路径在命令下方显示

5、设置github密钥

打开密钥生成路径在.ssh文件夹中用记事本打开id_rsa.pub文件把文件内容拷贝。把拷贝的密钥添加到github密钥设置中(需勾选复选框)。设置后保存

6、连接到github

git remote add origin https://github.com/test/Test.git(服务器上的地址)

出现错误:

fatal: remote origin already exists

则执行以下语句:

git remote rm origin

再次执行git remote add origin https://github.com/test/Test.git即可。

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

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

则执行以下语句:

git pull origin master

先把远程服务器github上面的文件拉先来,再push 上去

相关文章

  • GitHub上传本地项目 之 Github设置SSH keys

    GitHub上传本地项目 之 Github本地项目上传 (2) 一、 准备 (1) 安装 git 在Xcode已经...

  • github

    如何使用Git上传项目代码到github 提交本地代码到github github 的命令 如何提交changes...

  • 本地项目上传到github

    在github上创建项目 本地上传cd到项目文件夹git initgit add .git commit -m "...

  • git 上传本地代码到github仓库全流程

    git 上传本地代码到github仓库全流程 1、git add .,上传当前项目所有内容到本地仓库暂存区 2、g...

  • git入门

    Git使用方式: 本地使用 本地上传Github 下载Github仓库 ①本地使用 思路:创建项目目录-->创建....

  • git入门

    Git使用方式: 本地使用 本地上传Github 下载Github仓库 ①本地使用 思路:创建项目目录-->创建....

  • 命令行的方式上传项目到GitHub

    1.上传本地项目到github 第一步:在目录下建立git本地仓库。 cd到你的本地项目根目录下,执行git命令 ...

  • Github 上传本地的工程到github 仓库

    上传本地文件到GitHub(没有从GitHub上下载的) 1 ,cd 本地工程 2,git init 3,git ...

  • github与git之间怎么建立连接

    github与git之间怎么建立连接 Git与 Github的连接与使用 本地项目上传到github 报错“mas...

  • git 操作

    git 初次上传项目到个github 1.在github新建仓库 2.本地文件操作:*touch README.m...

网友评论

      本文标题:git 上传本地项目到github

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