[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] git remote origin URLs [Was: Did I resolve this git issue correctl

From: Greg Chicares
Subject: [lmi] git remote origin URLs [Was: Did I resolve this git issue correctly?]
Date: Fri, 23 Mar 2018 14:33:20 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 2018-02-14 02:11, Vadim Zeitlin wrote:
> On Wed, 14 Feb 2018 00:13:06 +0000 Greg Chicares <address@hidden> wrote:
> GC> /opt/lmi/src/lmi[0]$git pull --rebase
>  BTW, why are any credentials involved when working with the local
> repository? This looks strange to me.

I think I've resolved this correctly.

I had configured git such that credentials were required for all
interaction between my local repository and origin/master, both
for pushing and for pulling. For pushing, that's obligatory:
savannah allows pushes only via SSH. For pulling, it's just a
nuisance to type a passphrase. Intriguingly, this command:

/opt/lmi/src/lmi[0]$git remote -v
origin  address@hidden:/srv/git/lmi.git (fetch)
origin  address@hidden:/srv/git/lmi.git (push)
xanadu  https://github.com/vadz/lmi.git (fetch)
xanadu  https://github.com/vadz/lmi.git (push)

shows a pair of distinct URLs that happen to have identical
values, so I guess I should change the "(fetch)" URL.

I had cloned the repository thus:
  git clone https://git.savannah.nongnu.org/r/lmi.git
and 'README.schroot' shows how I configured my working copy:
  # Iff this chroot needs write access to savannah, then reconfigure
  # the URL, using your savannah ID instead of mine:
  # git remote set-url origin address@hidden:/srv/git/lmi.git

I probably adapted that 'set-url' line from the savannah docs:

| git remote set-url origin ssh://address@hidden/srv/git/project.git

but I think I should change the command thus:

-  git remote set-url origin address@hidden:/srv/git/lmi.git
+  git remote set-url --push origin address@hidden:/srv/git/lmi.git

The git documentation seems misleading:

| With --push, push URLs are manipulated instead of fetch URLs.

There is no '--pull' option, and apparently:
 - without '--push', both push and fetch URLs are set
 - with '--push', the push URL is set instead of both URLs

Anyway, before making this adjustment, I had:

/opt/lmi/src/lmi[0]$cat .git/config
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = address@hidden:/srv/git/lmi.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "xanadu"]
        url = https://github.com/vadz/lmi.git
        fetch = +refs/heads/*:refs/remotes/xanadu/*

and here's the diff resulting from the changes I've now made:

 [remote "origin"]
-       url = address@hidden:/srv/git/lmi.git
+       url = git://git.savannah.nongnu.org/lmi.git
        fetch = +refs/heads/*:refs/remotes/origin/*
+       pushurl = address@hidden:/srv/git/lmi.git
 [branch "master"]

And now everything seems to work as desired:

/opt/lmi/src/lmi[0]$git pull
Already up to date.
/opt/lmi/src/lmi[0]$git push
Everything up-to-date

reply via email to

[Prev in Thread] Current Thread [Next in Thread]