首页 > 其他分享 >Git --远程仓库操作-推送/拉取

Git --远程仓库操作-推送/拉取

时间:2024-03-03 14:12:16浏览次数:34  
标签:git remote -- demo 拉取 github Git https com

git remote -v 查看当前所有远程地址别名

git remote add 别名 远程地址

192:git_demo futantan$ git remote add git_demo https://github.com/Clairedandan/git_demo.git
192:git_demo futantan$ git remote -v 
git_demo    https://github.com/Clairedandan/git_demo.git (fetch)
git_demo    https://github.com/Clairedandan/git_demo.git (push)
192:git_demo futantan$

//github.com/Clairedandan/git_demo.git 来源如上图
git push 别名 分支(一定要指定分支)
但是此时我报了一个error :

192:git_demo futantan$ git push git_demo master 

Username for 'https://github.com': Clairedandan

Password for 'https://[email protected]': 

remote: Support for password authentication was removed on August 13, 2021.

remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.

fatal: Authentication failed for 'https://github.com/Clairedandan/git_demo.git/'

解决方案如下:https://www.cnblogs.com/clairedandan/p/18049898  

192:git_demo futantan$ git remote add git_demo1 https://[email protected]/Clairedandan/git_demo.git/
192:git_demo futantan$ git remote -v 
git_demo    https://github.com/Clairedandan/git_demo.git (fetch)
git_demo    https://github.com/Clairedandan/git_demo.git (push)
git_demo1    https://[email protected]/Clairedandan/git_demo.git/ (fetch)
git_demo1    https://[email protected]/Clairedandan/git_demo.git/ (push)
192:git_demo futantan$ git push --set-upstream git_demo1 master
fatal: unable to access 'https://[email protected]/Clairedandan/git_demo.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 
192:git_demo futantan$ git push --set-upstream git_demo1 master
fatal: unable to access 'https://[email protected]/Clairedandan/git_demo.git/': Failed to connect to github.com port 443: Operation timed out
192:git_demo futantan$ git push --set-upstream git_demo1 master
Branch 'master' set up to track remote branch 'master' from 'git_demo1'.
Everything up-to-date
192:git_demo futantan$ 

也可以推送到别的分支上

192:git_demo futantan$ git checkout new_branch1
Switched to branch 'new_branch1'
192:git_demo futantan$ git push --set-upstream git_demo1 new_branch1
Total 0 (delta 0), reused 0 (delta 0)
remote: 
remote: Create a pull request for 'new_branch1' on GitHub by visiting:
remote:      https://github.com/Clairedandan/git_demo/pull/new/new_branch1
remote: 
To https://github.com/Clairedandan/git_demo.git/
 * [new branch]      new_branch1 -> new_branch1
Branch 'new_branch1' set up to track remote branch 'new_branch1' from 'git_demo1'.
192:git_demo futan

此时都成功push 成功,对应的文件也都能找到

 拉取code 

git pull 别名 分支

git pull git-demo master 

首先在github 中修改master 中的一个文件,然后可以在本地pull 到刚刚改的东西:

192:git_demo futantan$ git pull git_demo1 master
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/Clairedandan/git_demo
 * branch            master     -> FETCH_HEAD
   eaf912c..92ed3e7  master     -> git_demo1/master
Updating eaf912c..92ed3e7
Fast-forward
 hello.txt | 1 +
 1 file changed, 1 insertion(+)
192:git_demo futantan$ 
此时就可以查到本地库是干净的,并且是最新的状态

标签:git,remote,--,demo,拉取,github,Git,https,com
From: https://www.cnblogs.com/clairedandan/p/18049980

相关文章

  • 对于Windows系统的入侵痕迹溯源,以下是一些基础技术原理
    对于Windows系统的入侵痕迹溯源,以下是一些基础技术原理:日志分析:通过分析Windows系统的各类日志,包括安全日志、事件日志、系统日志等,可以追踪潜在的入侵行为和异常活动。关注登录记录、权限变更、文件访问等操作,以发现不明示的活动。网络流量分析:监控网络流量,并分析与Windows......
  • Windows 系统日志是记录操作系统活动的重要组成部分,对于入侵排查和溯源来说,分析系统日
    Windows系统日志是记录操作系统活动的重要组成部分,对于入侵排查和溯源来说,分析系统日志是非常关键的一步。以下是针对Windows系统日志分析和溯源的基础技术原理:事件日志:Windows操作系统生成多个类型的事件日志,包括应用程序日志、安全日志和系统日志。了解不同类型的事件日......
  • JXOI2024 游记
    上洛谷打个卡,大凶,我只能说我不迷信这种东西。8:30开考,等着去考场。火大,T1没写完,T2写了个12的部分分,T3没写。是我菜了。下午越来越火大,再加上没有带耳机,更火大了。晚上收到了zaochen的外出邀请,但是我在师大里面,特别不方便,于是作罢。(这还是我第一次收到别校OIer的邀......
  • CompletableFuture使用说明
    前言创建线程的方式只有两种:继承Thread或者实现Runnable接口。但是这两种方法都存在一个缺陷,没有返回值Java1.5以后,可以通过向线程池提交一个Callable来获取一个包含返回值的Future对象Future接口的局限性当Future的线程进行了一个非常耗时的操作,那我们的主线程也就阻塞了......
  • Volatile关键字原理
    转载请标明:https://www.cnblogs.com/tangZH/p/15113505.html一、如果一个变量被volatile关键字修饰,那么所有线程都是可见的。所谓可见就是,当一条线程修改了这个变量值,新值对于其他线程来时是立即可见的; 而普通变量不能做到这一点。 1、现在计算机缓存架构:  CPU与内存之......
  • Glide源码解析四(解码和转码)
    本文基于Glide4.11.0Glide加载过程有一个解码过程,比如将url加载为inputStream后,要将inputStream解码为Bitmap。 从Glide源码解析一我们大致知道了Glide加载的过程,所以我们可以直接从这里看起,在这个过程中我们以从文件中加载bitmap为例:DecodeJob的一个方法:privatevoiddec......
  • vs工具dumpbin查看依赖的lib、dll
    转载:https://blog.csdn.net/weixin_34910922/article/details/109320939?spm=1001.2101.3001.6650.11&utm_medium=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~Rate-11-109320939-blog-104154281.pc_relevant_aa&depth_1-utm_source=distribute.pc_relev......
  • x-www-form-urlencoded 方式
    转载:https://blog.csdn.net/Wu7z_/article/details/108224944?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~Rate-2-108224944-blog-78784787.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant.......
  • day52 动态规划part9 代码随想录算法训练营 213. 打家劫舍 II
    题目:213.打家劫舍II我的感悟:看了题解不难,就是环这个思路转化很重要!理解难点:环的转化为,首,尾。代码上面可以省略长度为2的校验听课笔记:分3中情况:不考虑首尾|考虑首|考虑尾而情况2和情况3包含了情况1我的代码:classSolution:defrob(self,nums:List[i......
  • 使用 CSS 如何禁用浏览器打印页面 All In One
    使用CSS如何禁用浏览器打印页面AllInOneprint.css禁用PDF导出网页有时,你的网站或应用程序可能希望改善用户在打印内容时的体验。有几种可能的情况:你希望根据纸张的大小和形状调整布局。你希望使用不同的样式来增强纸上内容的外观。你希望使用更高分辨率的图像以......