2

I am Try to push code with automate deploy and pull process to the production server, but I got an error in the pipeline build process like this

fatal: could not read Username for 'https://gitlab.com': No such device or address

here is a .gitlab-ci.yml

script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- echo "$PRIVATE_KEY_STAGING" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh -p22 ec2-user@$SERVER_STAGING "uname -a"

How to Login to My Server and pull my updated code using Gitlab CI/CD?

Thanks in advance

perymerdeka
  • 766
  • 9
  • 19
  • This is probably a Docker issue. It's definitely not a Git thing. – torek Mar 10 '21 at 21:27
  • this is authentication for private repo, how to bypass it? torek – perymerdeka Mar 12 '21 at 09:32
  • You don't *bypass* it so much as figure out what "device or address" the program needs (/dev/random? /dev/tty? I don't know, the complaint is weird here) and make sure that the right mount points are instantiated in your Docker setup. – torek Mar 12 '21 at 10:06
  • I have checked my docker configuration and all passed, but if I pull git repo in the server, this require username and password – perymerdeka Mar 12 '21 at 11:54
  • There is no `git pull` command in your script, so what's running `git pull`? Why is it not using ssh authentication or a PAT? – torek Mar 12 '21 at 15:51
  • solved, I use personal Access Token to pull my private repo – perymerdeka Mar 13 '21 at 12:50
  • Does this answer your question? [GitLab remote: HTTP Basic: Access denied and fatal Authentication](https://stackoverflow.com/questions/47860772/gitlab-remote-http-basic-access-denied-and-fatal-authentication) – Arty-chan Sep 28 '21 at 23:54

1 Answers1

1

Since you got it resolved, how about to describe better here what have you done?

It may be more usefull to the community rather then a simple

"solved, I use personal Access Token to pull my private repo"

MMJ
  • 555
  • 4
  • 6