git——新旧项目push到远程仓库
新创建了一个远程仓库,如何将已有的代码推上去呢?或者如何本地新建一个仓库呢?所有情况如下所示:Git global setupgit config --global user.name "你的名字"git config --global user.email "你的邮箱"Create a new repositorygit clone ssh://路径.git...
·
新创建了一个远程仓库,如何将已有的代码推上去呢?
或者如何本地新建一个仓库呢?
所有情况如下所示:
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
更多推荐
所有评论(0)