1

On my server I have my personal user and I have another application user(app).

I'm su to the (app) user I setup my git remote origin - my git conf file now looks like this:

cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = [email protected]:example/mysite.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

Problem being is that in order to ssh into git it needs to use my personal ssh key under my user (not under the app user) - how is this usually handled? creating a new ssh key for my (app) user doesn't seem great - is there a config way thats understood to point to my users .ssh/key?

2
  • I used a ssh config to assign a specific key to a url. Commented Jul 6, 2020 at 0:00
  • But that ssh config will need to be under my app user and points to a key under my personal.ssh? I don’t think permissions will allow that Commented Jul 6, 2020 at 0:04

1 Answer 1

1

But that ssh config will need to be under my app user and points to a key under my personal.ssh? I don’t think permissions will allow that

Then you need to create a dedicated key, for app user to access the remote repository with the right account.
That still involves a ~app/.ssh/config file, in order to use the right (new) SSH key

 Host ghperso
   Hostname github.com
   User git
   IdentityFile ~/.ssh/dedicatedKey

And the URL would then be:

git remote set-url origin ghperso:example/mysite.git
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.