go get: Git settings ignored - go

I'm using Golang and GitLab CI, and I've got a GitLab CI configuration which works perfectly for 12 projects, but not for a 13th.
The problem I have is that I'm trying to go get some private repositories, which go get tries to run over HTTPS, which is turned off.
The solution, that works in the other repos, is this:
git config --global url."git#gitlab.my.site:".insteadOf "https://gitlab.my.site/"
However, in the runner for this one project, on the same GitLab, with the exact same config (except for the service name), this happens:
[...]
$ git config --global url."git#gitlab.my.site:".insteadOf "https://gitlab.my.site/"
$ cd ${APP_PATH}
$ go get
# cd .; git clone https://gitlab.my.site/group/project.git /go/src/gitlab.my.site/group/project
Cloning into '/go/src/gitlab.my.site/group/projects'...
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.
Why is it suddenly trying to clone over HTTPS? It happens in this one project only, consistently, but works in all the other ones. The only reason I can think about is that this one project uses a lot of different repos, rather than just one or two, but I have a hard time seing that this would be the actual issue.
How can I troubleshoot this?
Thanks.

Found the answer, and it's silly, and of course, my fault. I hadn't added the deploy key to the projects, of course rejecting the clones.
To fix the problem, in GitLab, go to the repository and then "Settings" > "Repository" and fold out "Deploy keys". There, make sure that the key you're trying to clone with is available and enabled.

Related

Upload Go project to GitHub Repository

How can i successfully upload my Go project to existing github repository? Here is how my $GOPATH looks like: /home/user/go.
There I have created the following directories: src/github.com/StefanCepa/ . And inside that directory I have 2x directories which represent two different projects. I would like each of those projects to be posted on seperate github repository.
Any ideas how can I do that? Commiting stuff written in Go on github is kinda confusing to me.
This is done the same way that you would initialize and commit a new repository regardless of the language.
Go just makes it a little easier to find your other Go projects thanks to the $GOPATH and the standards of the language. Simple example below.
Within project 1:
$ cd ~/go/src/github.com/StefanCepa/projectOne/
$ git init
$ git add .
$ git commit -m 'init'
$ git remote add origin https://github.com/StefanCepa/projectOne.git
$ git push -u origin master
Within project 2:
*same process as above

Is there any way to prove a heroku deployment corresponds to a github repo?

I want to set an opensource project where users can be sure that the deployed version .heroku.com corresponds with the actual source code in github master branch github.com/
Is there any way to prove a heroku deployment corresponds to a github repo?
Your app can spit out the latest deployed Git SHA if it has the "Dyno Metadata" feature turned on: https://devcenter.heroku.com/articles/dyno-metadata
Using that, you can show the latest SHA and compare it against the public repo.
Also, to add to what Jon said, you can do this via the heroku releases command. Every release, be it a code deployment, config var is 'tagged' - the command will show you everything that has changed on your app and a deploy will show the short git SHA, you can copy the SHA and then use the git command to search the repo for it.
eg.
assuming heroku releases returns
v10 Deploy 33f21247 foo#bah.com 2018/09/03 10:01:38 +0100
then you could do:
git cat-file commit 33f21247
which will then output the corresponding match, or a message saying it's not found. Obviously, this assumes your local repo is in sync with GitHub. To check it against GitHub you'd need to open your repo on GitHub like:
https://github.com/heroku/{projectname}/commit/{sha}
which will show the same commit on GitHub.

Can't push to TFS Git repository from Eclipse, but command line works fine

I have a Git repository provided by my organization's local instance of TFS. I can checkout, pull, switch branches, etc, all from within Eclipse using the built in capabilities, but when I try to push commits, it times out after 5 minutes with the error:
Can't connect to any repository: ssh://<my redacted project URL> (ssh://<my redacted project URL>: Short read of block.)
It works fine from the Git Bash command line, and as mentioned all other commands seem to work fine from Eclipse.
There is a similar issue reported here : https://bugs.eclipse.org/bugs/show_bug.cgi?id=531807
Based on the comments looks like jgit received some corrupt data during push.
Just try David's solution :
Copying out changed files, deleting project and repo, recloning repo,
creating project, copying back in changed files, pushing. Success.
Basically try to clone a new local repo, tested on my side and it works as expected.

GitHub error "Failed to get HEAD"

I'm new to GitHub and mainly going to be using it to backup service and to show off code. Anyhow, I'm trying to get my latest program up there and am getting the error in the title of this thread when I try to push.
Repro steps:
Sit in Starbucks with crappy wifi (Could this be related to the problem? Serious question.)
Open latest version of GitHub for latest Macintosh operating system
File --> New Repository
Local Path --> the folder that contains my XCode project
Name --> give it a name
Publish
Sync
Push .... Get error
Look in my XCode project's folder and it looks like an empty subfolder with the name of my GitHub project was created there. Huh?
I had these issues, I followed these steps to resolve.
cd /directory
git init
git add .
git commit -m "Name of Repo"
I then opened the github desktop application and dragged the folder over.
All my files are now available and I can make commits. Hope this helps.
I received a similar error using GitHub Desktop on OS X. I got the error when trying to commit files for the first time to a newly created repository. The error message was something along the following: Failed To Get Head (Unborn)
The steps I followed to create the error were:
Created a new repository on GitHub.com
Cloned the empty repository using GitHub Desktop
Created a new project locally on my computer inside the directory I cloned the repository to in step 2.
Using GitHub Desktop, tried to commit the files. This is when I got the error.
To "fix" this, I went to GitHub desktop and created a ReadMe for the repository. I then 'Synced' the repository on GitHub Desktop and was able to commit.
This error can appear if you did not initiate the repository. make sure to check the box saying "Initialize this repository with a README"
In my case all I needed to do was to run:
git add -A
After this I was successfully able to commit through the GitHub client.
I was using Xcode and I copied some files into the folder with my project and they were not automatically added to the git (hence the error).
git reset
And then come back to GitHub Desktop. That works in my case.
Certainly not the Starbucks Wifi.
This happened to me with the official GitHub client when I tried to make an initial commit, I then tried again using the inbuilt versioning module within my code editor (Intellij IDEA) and it worked just fine.
I won't even hazard a guess to the cause of the problem, but try a different GIT client if you need a potential quick fix.
Please try to commit first and try to push. I am also very new to git, I used to SVN a lot, It worked for me after initial commit.

Why won’t Jenkins running on my Mac connect to a local git repo?

I am trying to implement automated builds using Jenkins for my iOS projects. I added the Git plugin, but as soon as I try to put the URL for git in the git configuration for the project, it is showing the error in the screen shot below. Here Jenkins cannot clone from the repo to its workspace.
For the "Repository URL" field it is expecting a remote repository URL, something like git#github.com:github/hubot.git. It will use that url to copy down code to run the job against.
If you just want to run a job in a particular directory where you already have the code you want to work against, then leave this section empty. You can set the directory that you want to run a job in by
1. scroll to the "Advanced Project Options" section
2. click "Advanced"
3. Check "Use custom workspace"
For one off things, this is fine, but if you use this a lot, I think you'll find it more useful to commit your code to github and have jenkins clone down a fresh copy of code for each run.
You will get that error if you miss the following cases:
Whenever the clone URL is wrong.
When you are trying to clone from a place where you don't have the
access to git server.
Whenever your Pem key is not added to the list of keys on the git
server.
In most cases git bare repo has extension .git
I mean (other)/test1 dont look correct, i think it should be (other)/test1.git had this same error on my mac.
Actually i solved the issue . it was because of the permission the remote git is not updating properly

Resources