新创建了一个远程仓库,如何将已有的代码推上去呢?

或者如何本地新建一个仓库呢?

所有情况如下所示:

 

Git global setup

git config --global user.name "你的名字"
git config --global user.email "你的邮箱"

Create a new repository

git clone ssh://路径.git
cd 远程仓库名
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Push an existing folder

cd existing_folder
git init
git remote add origin ssh://路径.git
git add .
git commit -m "Initial commit"
git push -u origin master

Push an existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://路径.git
git push -u origin --all
git push -u origin --tags

 

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐