git学习及遇到的麻烦
程序员文章站
2024-03-21 13:02:22
...
git 学习
PS C:\Users\Administrator\Desktop\work> git clone http://10.8.0.67:3000/python_group/teach_platform.git
Cloning into 'teach_platform'...
remote: Counting objects: 37, done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 37 (delta 11), reused 0 (delta 0)
Unpacking objects: 100% (37/37), done.
PS C:\Users\Administrator\Desktop\work> cd .\teach_platform\
PS C:\Users\Administrator\Desktop\work\teach_platform> git branch
* master
PS C:\Users\Administrator\Desktop\work\teach_platform> git branch dev
PS C:\Users\Administrator\Desktop\work\teach_platform> git branch
dev
* master
PS C:\Users\Administrator\Desktop\work\teach_platform> git checkout dev
Switched to branch 'dev'
PS C:\Users\Administrator\Desktop\work\teach_platform> git branch
* dev
master
PS C:\Users\Administrator\Desktop\work\teach_platform> git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
PS C:\Users\Administrator\Desktop\work\teach_platform> git add .
PS C:\Users\Administrator\Desktop\work\teach_platform> git push
Everything up-to-date
PS C:\Users\Administrator\Desktop\work\teach_platform>
PS C:\Users\Administrator\Desktop\work\teach_platform> git remote add me http://10.8.0.67:3000/Arrow/teach_platform.git
PS C:\Users\Administrator\Desktop\work\teach_platform> git push me master
Counting objects: 4, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 525 bytes | 525.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To http://10.8.0.67:3000/Arrow/teach_platform.git
1b48d45..e17afd9 master -> master
PS C:\Users\Administrator\Desktop\work\teach_platform> git remote remove me
PS C:\Users\Administrator\Desktop\work\teach_platform> git remote -v
origin http://10.8.0.67:3000/python_group/teach_platform.git (fetch)
origin http://10.8.0.67:3000/python_group/teach_platform.git (push)
PS C:\Users\Administrator\Desktop\work\teach_platform> git push -u origin master
Everything up-to-date
Branch 'master' set up to track remote branch 'master' from 'origin'.
PS C:\Users\Administrator\Desktop\work\teach_platform> git pull
从头到尾的远程库创建
- 首先,选择一个合适的地方,创建一个空目录已有项目时,选择项目目录
git init 创建版本库
(vueshop) D:\djangoresttest\vueshop>git init
Initialized empty Git repository in D:/djangoresttest/vueshop/.git/
- 关联git里的仓库
1.先在github里创建新仓库(注意SSH公钥配置)
2.本地命令行进入项目目录:
git remote -v 空
git remote add lxgithub(默认origin) [email protected]:Arrowarcher/vueshop.git
3.完成后查看远程仓库关联
git remote -v
lxgithub [email protected]:Arrowarcher/vueshop.git (fetch)
lxgithub [email protected]:Arrowarcher/vueshop.git (push)
现在就能开心的git push/pull了
p.s. 初次pull可能会因为本地和远程库内容不一样造成冲突:
强行合并:
git pull --rebase origin master
或
git pull origin master --allow-unrelated-histories
初次push,设置默认push目标:
git push -u origin master
免密push可能需要的配置:
配置key之后还是不行可以尝试一下啊
git config --global credential.helper store
下一篇: 使用百度地图
推荐阅读
-
git学习及遇到的麻烦
-
ubuntu14.04安装Scrapy和redis时遇到的问题,及解决方法
-
支持IE及FIRFOX 添加连接到收藏夹的简易操作 博客分类: web开发学习笔记 WebJavaScriptIEFirfox
-
ETCD 源码学习--Raft 协议的逻辑时钟及相关消息类型(五)
-
ETCD 源码学习--Raft 协议实现的文件说明及 Raft 数据结构解析(三)
-
学习 Agile Web Development with Rails“ 8.3 循环 C1: 创建个购物车”遇到的问题 WebRailsActiveRecordRuby
-
搭建spring mvc rest返回json,xml遇到的问题,及解决办法 博客分类: java
-
kubernetes之ingress安装及遇到的rbac问题
-
C语言学习二:数据的表现形式及运算
-
Hadoop学习过程中遇到的问题总结