git ------ git clone方法总结(可直接加账户和密码)
设置账号和密码,解决仓库路径一样,但登陆者不同。不必全局改动账号!!!!git clone命令格式:git clone [--template=<template_directory>][-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror][-o <name>] [-b <nam...
设置账号和密码,解决仓库路径一样,但登陆者不同。不必全局改动账号!!!!
git clone命令格式:
git clone [--template=<template_directory>]
[-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
[-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
[--dissociate] [--separate-git-dir <git dir>]
[--depth <depth>] [--[no-]single-branch]
[--recursive | --recurse-submodules] [--[no-]shallow-submodules]
[--jobs <n>] [--] <repository> [<directory>]其中,常用的参数如下:
-n, 不检出Git库中的active branch
-o new_origin, 使用new_origin,而不使用默认的origin,作为跟踪分支的upstream所在库
-b new_branch, 设置本地的active branch,而非默认的master branch
--single-branch, 只检查一个branch,要么是默认的master,要么是-b new_branch指定的new_branch
--recursive, 在本地初始化Git库中的所有模块
1.git clone 不指定分支(默认master分支)
git clone 远程仓库git地址 <本地仓库名> // <>自定义本地仓库名,不写默认远程分支名
2.git clone 指定分支(非主分支)
git clone -b 远程指定分支 远程仓库git地址 <本地仓库名> // <>自定义本地仓库名,不写默认远程分支名
3.不设全局账号密码,拉取远程指定仓库的代码:
git clone http://username:password@remote
例子:
地址为:(http://)(git.xxx.com/www.git) ()是书写时要分开的:
git clone http://username:password@git.xxx.com/www.git
4.拷贝一个 Git 仓库到本地,重新定义本地目录名称
git clone <版本库的网址> <本地目录名>
example:
git clone http://git@cocoli.git my-master //远程默认为master ,本地设置为了my-master
5.拷贝一个git仓库,修改远程仓库名:
git clone -o new_remote_name <url> <new_branch>
“origin” 并无特殊含义
远程仓库名字 “origin” 与分支名字 “master” 一样,在 Git 中并没有任何特别的含义一样。
同时 “master” 是当你运行 git init 时默认的起始分支名字,原因仅仅是它的广泛使用,
“origin” 是当你运行 git clone 时默认的远程仓库名字。 如果你运行 git clone -o
booyah,那么你默认的远程分支名字将会是 booyah/master。
更多推荐
所有评论(0)