Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubuntu下使用git上传项目到github中 #2

Open
gaowei1012 opened this issue Jun 10, 2017 · 0 comments
Open

ubuntu下使用git上传项目到github中 #2

gaowei1012 opened this issue Jun 10, 2017 · 0 comments

Comments

@gaowei1012
Copy link
Owner

gaowei1012 commented Jun 10, 2017

检查是否安装git

可以使用git --version 测试,如果没有安装,用以下命令安装:
sudo apt-get install git git-core 安装git

获取秘钥

ssh-keygen -C "你的github邮箱" -f ./ssh/github
这时候会在你的电脑上~./下生成一个目录 ssh 文件夹
用以下命令打开编辑:

  cd ~/.ssh
  ssh -keygen -t rsa   //获取秘钥

之后一路回车...

秘钥认证

接下来登录我们的github在登录左上角里面进去设置,打开设置后你会发现在左边有个ssh 秘钥,进去把刚刚在命令行打开的文本里面的内容复制粘贴进去,保存.
好了,至此我们的环境就软搭建完成.

本地创建项目文件

 在本地创建一个专门存放上传文件的到github的仓库,进入其中,输入以下代码:

  git clone [email protected]:xxx-xxx.git   // [email protected]:xxx-xxx.git 这里的地址是你仓库里项目的路径

这样你在云端仓库的项目就会clone在你本地电脑里面.

之后就按照下面的步骤:

  git add . //更新整个目录
  git config user.name "xxx-xxx" //xxx-xxx  你的github名称(首次)
  git donfig user.email "[email protected]"  // [email protected] 你的邮箱(首次)
  git commit -m "更新的版本说明"
  git push -u origin master 

之后如要要上传文件, 直接把文件复制到这个文件目录下,执行以下代码:

  git add .
  git commit -m "更新版本说明"
  git push -u origin master

这样就把我们本地文件上传到github里面了.

@gaowei1012 gaowei1012 changed the title 分享知识 ubuntu下使用git上传项目到github中 Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant