如何在git创建仓库并上传更新

来源:互联网 发布:淘宝名字能改吗 编辑:程序博客网 时间:2024/06/03 05:07

command line instruction

Git global setup

git config --global user.name "your_define_name"git config --global user.email "your_email_name"
全局的一个配置:创建一个用户名以及相关的邮箱地址

Create a new repository

git clone (your address,for example)https://github.com/liuqk_spirits/classification.gitcd classificationtouch README.MDgit add README.MDgit commit -m "add README"git push-u origin master
创建一个库repository,并且关联到本地一个文件夹,上传文件以及更新都是在本地进行,这里创建了一个名为classification的项目库,在这个库下面创建了readme文件,并上传到github对应的classification repository中。
git add * #添加
git commit -m "your_explain" #提交为添加的文件注释、说明
git push -u origin master # 提交完之后,推送到github中,-u 这个参数表示是第一次上传,以后可以省略不写

Existing folder or Git repository

cd existing_folder #in your home addressgit initgit remote add origin http://github.com/liuqk_spirits/your_repository_name.gitgit add *git commit -m "***"git push -u origin master
本地文件夹关联到远程仓库,通常仓库名与本地文件夹名要一致;

delete files in the repository

cd your_repositorygit rm ** #files you want delete or use 'git rm -r your folder'git commit -m "delete files"git push origin master

可以使用git status查看当前操作的状态,将会提示你下一步该怎么做,有时推送(git push origin master)这一步可能会出错,则可以推送之前,执行git pull origin master 将仓库拉下来再推送。以上操作基本可以满足git常用操作。




原创粉丝点击