在Ubuntu上创建Git仓库并上传到GitHub
1、安装 Git $ sudo apt-get install git git-core 检查: 2、基本配置 $ git config --global user.name <your-name> $ git config --global user.email <your-email> 3、假设项目名为 helloworld,执行下面命令,进到项目目录,创建版本库 $ cd helloworld $ echo "# helloworld" >> README.md $ git init 4、Staging 被修改的文件,并提交更新 $ git add . $ git commit -m "first commit" 5、仓库托管到 GitHub,需要 SSH Key 验证,执行下面命令创建 SSH Key $ ssh-keygen -t rsa 之后在 ~/.ssh/ 目录下可以看到 6、然后登陆 GitHub,上传 SSH Key 公钥 依次选择“Settings –> SSH and GPG keys –> New SSH key”,填上适当的 Title,并复制 7、在 GitHub 上新建一个仓库(假设名为 helloworld),然后执行如下命令 $ git remote add origin https://github.com/<your-name>/helloworld.git 8、接着,就可以把本地仓库的所有内容推送到远程仓库 $ git push -u origin master 可能遇到的问题: 1、remote: fatal: early EOF 在repo sync 时,,出现“remote: fatal: early EOF”错误,解决方法是修改家目录下 .gitconfig 文件,添加如下内容: [core] compression = -1 2、提示如下警告
这是因为有的文件大小超过 50 MB,参考说明,可知:GitHub will warn you when pushing files larger than 50 MB. You will not be allowed to push files larger than 100 MB. (编辑:台州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |