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 [email protected] git reset --hard ... git pull 

But I still get prompted for a password. I assume the remote needs to be [email protected] 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?

2 Answers 2

1

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

cd a git remote set-url origin [email protected]/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).

Sign up to request clarification or add additional context in comments.

1 Comment

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
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.