git-remote

Git - Checkout a remote tag when two remotes have the same tag name

ⅰ亾dé卋堺 提交于 2019-11-26 09:17:05
问题 I had hoped this would work: git checkout remote/tag_name but it doesn\'t. This does: git checkout tags/tag_name but I\'m doing something weird where I have a lot of remotes, and I\'m worried about what happens if two remotes have the same tag. Is there a way to specify the remote when checking out the tag? 回答1: Executive summary: what you want to achieve is possible, but first you must invent remote tags. You do this with a series of refspecs, one for each remote. The rest of this is about

How to add a local repo and treat it as a remote repo

为君一笑 提交于 2019-11-26 07:53:35
问题 I\'m trying to make a local repo act as a remote with the name bak for another local repo on my PC, using the following: git remote add /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git bak which gives this error: fatal: \'/home/sas/dev/apps/smx/repo/bak/ontologybackend/.git\' is not a valid remote name I\'m trying to sync two local repos, with one configured as a remote named bak for the other, and then issuing git pull bak . What is the best way to do it? Edit: Sorry, silly me, I\'ve

Remote origin already exists on 'git push' to a new repository

拥有回忆 提交于 2019-11-26 07:51:07
问题 I have my project on GitHub at some location, git@github.com:myname/oldrep.git . Now I want to push all my code to a new repository at some other location, git@github.com:newname/newrep.git . I used the command: git remote add origin git@github.com:myname/oldrep.git but I am receiving this: fatal: remote origin already exists. 回答1: You are getting this error because "origin" is not available. "origin" is a convention not part of the command. "origin" is the local name of the remote repository

How to remove remote origin from Git repo

走远了吗. 提交于 2019-11-26 06:52:22
问题 I just did git init to initialize my folder as git repo and then added a remote repository using git remote add origin url . Now I want to remove this git remote add origin and add a new repository git remote add origin new-url . How can I do it? 回答1: Instead of removing and re-adding, you can do this: git remote set-url origin git://new.url.here See this question: Change the URI (URL) for a remote Git repository 回答2: If you insist on deleting it: git remote remove origin Or if you have Git

What are the differences between local branch, local tracking branch, remote branch and remote tracking branch?

自闭症网瘾萝莉.ら 提交于 2019-11-26 06:51:53
问题 I just started using Git and I got really confused between different branches. Can anyone help me to figure out what the following branch types are? local branches local tracking branches remote branches remote tracking branches What is the difference between them? And how do they work with each other? A quick demo code will be really helpful I guess. 回答1: A local branch is a branch that only you (the local user) can see. It exists only on your local machine. git branch myNewBranch # Create

Git branching: master vs. origin/master vs. remotes/origin/master

谁说我不能喝 提交于 2019-11-26 04:29:32
问题 I think I\'m on the right track to understand the basic concepts of git. I\'ve already set up and cloned a remote repository. I also created a server side empty repository, and linked my local repository to it. My problem is that I don\'t understand the difference between: origin/master vs. remotes/origin/master As far as I have understood, master is a local branch, and remotes/origin/master is a remote one. But what exactly is origin/master ? 回答1: Take a clone of a remote repository and run

How can I determine the URL that a local Git repository was originally cloned from?

戏子无情 提交于 2019-11-26 03:46:30
问题 I pulled a project from GitHub a few days ago. I\'ve since discovered that there are several forks on GitHub, and I neglected to note which one I took originally. How can I determine which of those forks I pulled? 回答1: If you want only the remote URL, or if your are not connected to a network that can reach the remote repo: git config --get remote.origin.url If you require full output and you are on a network that can reach the remote repo where the origin resides : git remote show origin

Completely remove files from Git repo and remote on GitHub

限于喜欢 提交于 2019-11-26 02:27:34
问题 I accidentally added a folder of images and committed. Then, I made one more commit. Then I removed those files using git rm -f ./images and committed again. Right now, I have made a lot more commits in that branch (master). In my HEAD, I don\'t have that ./static/images folder. Due to this, my repo size has increased a lot. How can I remove those blobs completely? And I want to remove it from my remote GitHub repo too. 回答1: This is what you're looking for: ignoring doesn't remove a file. I

Change a Git remote HEAD to point to something besides master

为君一笑 提交于 2019-11-26 00:31:55
问题 How do I set a Git remote\'s HEAD reference to point to something besides \"master\"? My project has a policy not to use a \"master\" branch (all branches are to have meaningful names). Furthermore, the canonical master repository is only accessible via ssh://, with no shell access (like GitHub or Unfuddle). My problem is that the remote repository still has a HEAD reference to refs/heads/master, but I need it to point to a different branch. This is causing two problems: When cloning the repo

How do I push a new local branch to a remote Git repository and track it too?

…衆ロ難τιáo~ 提交于 2019-11-25 23:23:48
问题 I want to be able to do the following: Create a local branch based on some other (remote or local) branch (via git branch or git checkout -b ) Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately. How do I do that? I know about --set-upstream in Git 1.7, but that is a post-creation action. I want to find a way to make a similar change when pushing the branch to the remote repository. 回答1: In Git 1.7.0 and later, you can