Preserve git remotes

I have fixed network of git remotes and I would like them to be attached to repository. Unfortunately git-clone doesn't clone remotes. Is there a way around it?

-------------Problems Reply------------

I begin this command

for save the remotes in a .gitremotes file

There is no way to do this with git, as far as I know.

Telling users to run scripts post-clone is what people tend to do. If it's a ruby project, you probably have rake, for example, so you could have a rake post_install task.

Remotes are saved in .git/config file of a repo, you can extract your favorites and append them on every clone.

You could define them in your global config file ~/.gitconfig instead of your project's .git/config. Be careful though... if you run git remote update in a project it will pull down all remotes, even for repositories completely unrelated to the one you're working on.

Category:git Views:7 Time:2009-10-15

Related post

  • GitHub git remote add origin [email protected]:username/ProjectName a one time process? 2009-12-02

    if I have two git projects on my machine with two different ProjectNames can I manage it with this code in two directories like this /foo1$ git remote add origin [email protected]:username/ProjectName-1 /foo2$ git remote add origin [email protected]:userna

  • Differences between git remote update and fetch? 2009-12-06

    Is git remote update the equivalent of git fetch? --------------Solutions------------- Yes and no. git remote update fetches from all remotes, not just one. Without looking at the code to see if remote update is just a shell script (possible) it, bas

  • Unable to push code to git remote 2009-12-07

    I am trying to add remote using git remote add and than am trying to push to that remote but am getting following errors: fatal: 'adoshi_01': unable to chdir or not a git archive and fatal: The remote end hung up unexpectedly Steps followed: First of

  • Is the Git remote name origin only applied to one created by git clone? 2010-04-03

    Does Git only use the remote name origin for a repository which was created by cloning? eg, say I create a repository, place it on a remote, and try to clone it again into the same directory, which one would Git name origin? --------------Solutions--

  • Error with git: remote HEAD is ambiguous, may be one of the following 2010-04-04

    After branching and pushing to the remote, a git remote show origin gives the report HEAD branch (remote HEAD is ambiguous, may be one of the following): master otherbranch What does the imply? It is a critical error? remote origin Fetch URL: gituser

  • How can I attach multiple urls to a single git remote? 2010-04-15

    I'm currently using git on windows through a combination of msysgit and Cygwin. I have a laptop which I move around quite a bit, so it's not on a consistent location. Unfortunately, I don't have a consistent name for it due to the computer name not b

  • What is the difference between `git fetch origin` and `git remote update origin`? 2010-04-22

    In response to a question about pulling one commit at a time from a git repository, I was recommended to use git remote update instead of git fetch. I have read both man pages but cannot say I understood either in its entirety. Can anyone explain to

  • Groking git remote usage 2010-05-20

    I've been 'playing' with git on my own machine for 6 months now, and really loving it. However, I'm finding it difficult to really grok how I would use it in a team/enterprisey environment. (I'm wondering whether Eric Sink is right). I started out tr

  • Git Remote Repository Check-Out Problem 2010-06-30

    I've just started using Git and have never used a versioning system before. I am trying to setup a git repository on my web server and one on my local computer. I am doing the following on the server (I run the commands in a project folder ~/project)

  • git remote add with other ssh port 2010-08-29

    In git, how I can add a remote origin when my host use a different ssh port? git remote add origin ssh://[email protected]/srv/git/example --------------Solutions------------- You can just do this: git remote add origin ssh://[email protected]:1234/srv/git/example Y

  • git remote doesn't seem to be working at all 2010-09-20

    I'm following along with the, and when I get to the "git push heroku master" part, I get the following error: fatal: Not a git repository (or any of the parent directories): .git So I do some googling, and see a common troubleshooti

  • Setting the right group rights on a git remote repo 2010-10-15

    I've got a git remote repo at my server. Everytime I push my local branch to the server the files in ~/objects have just the rw permissions for my specific account(not my group – git). So when my friend does a push concerning those files in ~/objects

  • git remote prune – what am I doing wrong? 2010-10-28

    From the man page: Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in "remotes/<name>". So I removed a

  • Problems adding git remote repository 2011-02-18

    I'm having problems adding a remote repository to my local one. I first tried using Tower where I manged to add my local repo, but when it came to adding a remote repo it just said add the URL. It doesn't say anything about this URL. Should it includ

  • git remote branch deleted but still appears in 'branch -a' 2011-02-23

    Lets' say I had a branch named coolbranch in my repository. Now, I decided to delete it (both remotely and locally) with: git push origin :coolbranch git branch -D coolbranch Great! Now the branch is really deleted. But when I run git branch -a I sti

  • Problem with git: remote 'refs/heads/master' is not an ancestor of local 'refs/heads/master' 2011-02-24

    I faced to a situation which I don't understand. I have a remote git repo running on WebDAV / apache. Just to be sure, I logged on the server and run "chown -R wwwrun:www *" and "git update-server-info" on the relevant directory (as root, obviously).

  • How to 'git remote add' and track a branch in the same filesystem 2011-03-01

    I have 2 local git archives in /a and in /b which were cloned from remotes/origin. There is a new branch z on /b How can I track and fetch branch z from archive /a ? I tried this: cd /a git remote add b /b This creates 2 config entries, but I did not

  • git remote /home/username/www/lorem.git 2011-03-07

    How can I use /home/username/www/example.git with remote add command? if I use this: git remote add origin [email protected]:/home/user/www/example.git git push origin master I got this error: error: src refspec master does not match any. error: faile

  • How to prevent "git remote add ssh://" from establishing a connection? 2011-03-31

    I wrote a backup script for my server's users git repos. It adds new remotes to every repos (my own and other users too) pointing to the backup servers. This is a tricky operation since the script runs as root through cron.daily, must add the remote

Copyright (C), All Rights Reserved.

processed in 0.135 (s). 11 q(s)