github上传工程

247 阅读1分钟

1、生成 ssh

ssh-keygen -t rsa -C email(注册 github 的 email)

默认生成在~/.ssh

在 github,�点击头像 Settings -> SSH Keys,
将~/.ssh/id_rsa.pub 文件内容拷贝进来,title 填写 email

2、测试跟 github 连接

ssh -T git@github.com

3、配置 config
config 文件在~/.gitconfig。
可以用命令行来设置

git config --global user.name "your name"
git config --global user.email "your_email@youremail.com"

4、在 github 上创建 repository

5、本地仓库与远程建立连接

cd projectdir
git init
// 将所有文件 add
git add .
git commit -m "first commit"
// 添加远程仓库地址
git remote add origin github.com/silan-liu/b…
git push -u origin master

在 push 的时候,可能会提示,先 pull,则先执行 git pull origin master。