2

$ git remote -v

origin https://github.com/my-repo/site-web.git (fetch)

origin https://github.com/my-repo/site-web.git (push)

I have ssh set up and a shell script to run like this:

ssh -T git@github.com
git reset --hard
...
git pull

But I still get prompted for a password. I assume the remote needs to be git@github.com for the ssh to work.

I have four directories... a/ b/ c/ and d/ and all of them point to this remote. But I really only want ssh to work in a/. I'm happy to keep using https for the others.

What do I do?

Community
  • 1
  • 1
b85411
  • 9,420
  • 15
  • 65
  • 119

2 Answers2

1

If a/ is a git repo, you can simply change its remote:

cd a
git remote set-url origin git@github.com/my-repo/site-web.git

But if a, b, c and d are folder of the same repo, that would change origin for all of them.

To have ssh only for a/, you would need a separate clone, as a sparse checkout, in order to work only with a/ content (and have the right remote url for that separate clone).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi, yes all folders point to the same repo. Basically it's the same code in each but a different database. I just tried what you suggested and it did indeed change the remote for all of them. There's no way around this? Thanks – b85411 Dec 16 '14 at 06:50
0

You need to add your .ssh/id_rsa.pub to you github account.

argarevarg
  • 31
  • 4