Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working for private repository #39

Open
webmarts2019 opened this issue Nov 25, 2019 · 3 comments
Open

Not working for private repository #39

webmarts2019 opened this issue Nov 25, 2019 · 3 comments

Comments

@webmarts2019
Copy link

webmarts2019 commented Nov 25, 2019

Hi
I am trying to use this script for private repository, but its not working, although SSH is set up properly n gitlab but if I try to test

" fatal: could not read Username for 'https://gitlab.com': No such device or address HEAD is now at df699ba Add new file"

@mkpathcreate
Copy link

Getting similar error for private repo

=== ERROR: Pull failed using GIT /usr/bin/git and DIR /var/www/xxxx ===
fatal: could not read Username for 'https://github.com': No such device or address

@mkpathcreate
Copy link

mkpathcreate commented Dec 28, 2020

Ok i got this working. The problem is the folder permission for your GIT folder, it needs to be www-data (or httpd/apache user, the PHP file is run by apache user, so the git folder should be your apache user.)

You need to have the public keys generated for www-data user (or apache/httpd user based on your server configuration).

Step 1: (ON YOUR SERVER)

#let's be root
sudo -i

##go the apache folder
cd /var/www

##create folder to store keys
mkdir .ssh
chown -R www-data:www-data .ssh
##create keys
sudo -u www-data ssh-keygen -t ed25519 -C "[email protected]"
#click yes, yes in case you dont need a passphrase

##Start the ssh-agent in the background.
eval "$(ssh-agent -s)"
##add Key
ssh-add ~/.ssh/id_ed25519

##Copy the generated Pub key to be pasted on github.com
tail /var/www/.ssh/id_ed25519.pub

#Attempts to ssh to GitHub
sudo -u www-data ssh -T [email protected]

Step 2:

Copy/Add the key displayed above in tail command to your github account or repo, Repo->Settings->Deploy Keys.

#type "yes"

Step 3: (OPTIONAL, in case you had used HTTPS like me, you need to change it to ssh git)

Cd to your git folder for e.g /var/www/my-project folder
nano .git/config

Change

url = https://github.com/username/reponame

to

url = [email protected]:username/reponame.git

@Rengaht
Copy link

Rengaht commented Dec 5, 2021

Hi, I follow the steps above, but still get error as below:
can anyone help out~

=== ERROR: Pull failed using GIT /usr/bin/git and DIR /opt/bitnami/apache2/htdocs/ ===
Could not create directory '/usr/sbin/.ssh'.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants