configuring gitlab project for https access - clone

I have created a project in gitlab called git clone test. In the advanced setting feature i can see that cloning can be done only by git clone git#xxx.xx.xxx.xxx:git_clone_test.git. I want to clone using https protocol.
So i tried the following
git remote set-url origin https://xxx.xx.xxx.xxx/git_clone_test.git
verified
git remote -v
origin https://xxx.xx.xxx.xxx/git_clone_test.git (fetch)
origin https://xxx.xx.xxx.xxxgit_clone_test.git (push)
[edit]: gitlab.yaml has https turned on on port 443
But the following command
$ env GIT_SSL_NO_VERIFY=true git clone https://xxx.xx.xxx.xxx/git_clone_test.git
Cloning into 'git_clone_test'...
Gives the error:
fatal: https://xxx.xx.xxx.xxx/git_clone_test.git/info/refs not found: did you run git update-server-info on the server?
I think problem lies in the fact that gitlab does not allow me to change git clone field in advanced settings. Perhaps a server setting needs to change?
We are using gitlab (git+gitolite) on nginx server.
We are trying to use https access as this server is behind a firewall, and the client cannot clone it. They can see the web interface and and download files from that interface, but git operations pose a problem. We think that changing access to https might solve this problem
Any pointers would help
thanks
Sameer

It looks like you have forgotten some small changes within your gitlab.yml configuration.
To use HTTPS you also have to change the config file as follows
# https://github.com/gitlabhq/gitlabhq/blob/6-4-stable/config/gitlab.yml.example#L19-L20
port: 80
https: false
change to:
port: 443
https: true

We solved this issue by upgrading to latest version of gitlab which supports https access in a pretty straightforward manner

Related

How to set proxy using libgit2sharp?

I use libgit2sharp clone and faced "failed to send request: The operation timed out" when I am using corporate networking.
If I use my own 3G networking, it can clone successfully.
But after I use git config in command line and I can clone repository by command line, I still can't clone repository by the code....
could everyone teach me how to set proxy in the code or how to use this lib in proxy environment?
Thanks!

How Can I Configure GitHub Desktop/Windows to Work with a Proxy?

New to working with git in Windows. I downloaded the GitHub Desktop application and can connect my account, but doing pushes/pulls fails because of an unresolved host. Asking around the workplace I got the following suggestion to type this command into the git shell.
git config --global http.proxy http://username:password#proxy.workplace.com:8080
Does this:
Store my password in plain text?
Send my password in plain text?
Doesn't GitHub for Desktop generate and use SSH keys instead (I got an email notification when I first connected my account)? How can I configure GitHub Desktop to work with this proxy?
To directly add a proxy to Github Desktop without using git shell:
Set up/Sign in to your account in Github Desktop(This won't be a problem, proxy only doesn't allow you to Add, create or clone repo)
Close Github Desktop for the time being(to set up proxy).
Go to C:\Users\#yourusername.
There you will find a file named .gitconfig
Open it with any text editor(I have used sublime text 3) and add
[http]
proxy = http://username:password#your.proxy.address:8080
and save.
Now you can add, create and clone repos in Github Desktop.
Note(for TFS users): TFS will return 502 bad gateway error when you use the above proxy configuration. Use hash # to comment out the proxy config in .gitconfig to switch between Git and TFS.
So actually the solution was to type this command into the git shell.
git config --global http.proxy http://<proxy-ip>:<proxy-port>
Try and upgrade to GitHub Desktop 2.4 (March 2020)
Working behind a proxy
With GitHub Desktop 2.4, we automatically handle setup without needing you to configure anything manually—worry no more!
It might work with this:
git config --global http.proxy proxy_address:proxy_port
git config --global https.proxy proxy_address:proxy_port
If username and password are not that much important then use:
git config --global http.proxy username:password#proxy_address:proxy_port
git config --global https.proxy username:password#proxy_address:proxy_port

Xcode - Authentication failed error when adding repository with SSH auth

I am trying to add repository via Xcode > Settings > Accounts and I am stuck on the proper address. Address of our repo is quite simple: my.domain.com:port/project-name. Authentication via SSH Keys. Could someone help me to understand what's going on here? See screenshot below.
By the way running git clone git+ssh://git#my.domain.com:port/project-name works fine.
EDIT
Running git clone without git+ssh//
git clone git#my.domain.cz:2222/project-name
or
git clone git#my.domain.cz:22/project-name
is giving me same error:
ssh: connect to host my.domain.cz port 22: Connection refused
fatal: Could not read from remote repository
Please make sure you have the correct access rights and the repository exists.
Xcode accepts just ssh://git#my.domain.cz:2222/project-name.
The git protocol is somehow redundant in this case. Raw git tools don't have a problem with it, but Xcode does not like it for some reason.
It always fails for me when I use existing ssh keys.
I created a new ssh key pair through Xcode and uploaded the public key to the git server (in my case, Phabricator), and it works.

error: RPC failed; result=22, HTTP code = 400

I am trying to push my app on to Heroku, but I am getting this error message. I have looked around, someone mentioned about GitHub recently started redirecting http repository access to https and it appears your git is unhappy about this change. But I am having troubles pushing to heroku, any help will be much appreciated.
error: RPC failed; result=22, HTTP code = 400
This may occur due the reason that Heroku's Git doesn't understand shallow clone as mentioned here.
Workaround is to disable shallow clone before deployment.
git fetch --unshallow
change your postbuffer
git config --global http.postBuffer 52428800
then you postbuffer is 50M .
i hope this is not coming to late, but Heroku deployments require a full Git clone. By default, Pipelines clones your repository with a depth of 50 to shorten your build time. You can configure your Pipeline to do a full Git clone in your bitbucket-pipelines.yml file.
try adding full clone depth to your yml file
image: node:6
clone:
depth: full
It could be a glitch, as I mentioned in here.
(Actually, right as I write this, GitHub is having a "Major service outage"!)
Make sure you can reproduce the issue with an http or an https url.
If that persists, simply try and swith to an ssh url
git remote set-url heroku git#heroku.com:yourRepo
(which is the recommended approach, since heroku normally support ssh only)
The problem (could be) that you are probably used git clone --depth .. for your repository and that created so called shallow copy (without history).
If you cloned somebody else repository (!), just delete /.git folder and create a recreate repository as new with
cd <my-project>/
git init
Then you can push even with remote https://<youprojectname>.herokuapp.com/
For Rails 4: make sure you add "rails_12factor" gem to your Gemfile.

Git connect using ssh on windows

I have read some questions around but still didn't found the solution to this problem
I have git on windows and I want to connect to github using ssh.
Following this tutorial https://help.github.com/articles/generating-ssh-keys
I have successfully setup my keys
If I open a git-bash and try to ssh github I am able to connect, so this works
ssh -T git#github.com
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
this means that git-bash actually sees my keys. However if I try to do a push
git push origin master
git prompts me for username and password
Thank you for your help
EDIT: solved by using the git protocol instead of the http protocol, my fault
so replace this
https://github.com/_user_/_repository_.git
whit this
git#github.com:_user_/_repository_.git
in the remote link
No need to remove/add, just do something like this:
git remote set-url origin git#github.com:username/repo.git
You probably cloned a remote that uses the https protocol, rather than the git protocol. You need to redefine your remote for origin.
# Change this as needed.
github_username="$LOGNAME"
# Replace your remote, then push.
git remote rm origin
git remote add origin "git#github.com:${github_username}/${PWD##*/}.git"
git push --tags --set-upstream origin master

Resources