lfs fall with custom lfs server App Center - visual-studio-app-center

I have added a lfs config file .lfsconfig to my repo,
[lfs]
url = "https://{xxx}}"
At Travis CI, it run as i expected.
But at App Center, Seem it cannot recognise .lfsconfig, and use the GitHub lfs url one.
2019-07-03T07:22:34.4356490Z ##[section]Starting: Checkout
2019-07-03T07:22:34.4360890Z ==============================================================================
2019-07-03T07:22:34.4361160Z Task : Get sources
2019-07-03T07:22:34.4361330Z Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2019-07-03T07:22:34.4361540Z Version : 1.0.0
2019-07-03T07:22:34.4361760Z Author : Microsoft
2019-07-03T07:22:34.4361930Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2019-07-03T07:22:34.4362190Z ==============================================================================
2019-07-03T07:22:35.1331900Z Syncing repository: {repo} (ExternalGit)
2019-07-03T07:22:35.3173960Z ##[command]git version
2019-07-03T07:22:35.4055670Z git version 2.21.0
2019-07-03T07:22:35.4360390Z ##[command]git lfs version
2019-07-03T07:22:35.6350960Z git-lfs/2.7.2 (GitHub; darwin amd64; go 1.12.4)
2019-07-03T07:22:35.6734720Z ##[command]git init "/Users/vsts/agent/2.153.2/work/1/s"
2019-07-03T07:22:35.7248590Z Initialized empty Git repository in /Users/vsts/agent/2.153.2/work/1/s/.git/
2019-07-03T07:22:35.7314230Z ##[command]git remote add origin https://github.com/{my}/{repo}.git
2019-07-03T07:22:35.7467200Z ##[command]git config gc.auto 0
2019-07-03T07:22:35.7601000Z ##[command]git config --get-all http.https://github.com/{my}/{repo}.git.extraheader
2019-07-03T07:22:35.7688370Z ##[command]git config --get-all http.proxy
2019-07-03T07:22:35.7800530Z ##[command]git remote set-url origin https://***:***#github.com/{my}/{repo}.git
2019-07-03T07:22:35.7911940Z ##[command]git remote set-url --push origin https://***:***#github.com/{my}/{repo}.git
2019-07-03T07:22:35.8030150Z ##[command]git lfs install --local
2019-07-03T07:22:35.9461390Z Updated git hooks.
2019-07-03T07:22:35.9461770Z Git LFS initialized.
2019-07-03T07:22:35.9506710Z ##[command]git config remote.origin.lfsurl https://***:***#github.com/{my}/{repo}.git/info/lfs
2019-07-03T07:22:35.9588600Z ##[command]git config remote.origin.lfspushurl https://***:***#github.com/{my}/{repo}.git/info/lfs
Is there any way i can use set the lfs url at App Center ?

git config remote.origin.lfsurl overrides lfsconfig unfortunately.
see https://github.com/git-lfs/git-lfs/blob/master/docs/man/git-lfs-config.5.ronn#configuration-files
"Settings from Git configuration files override the .lfsconfig file. This allows you to override settings like lfs.url in your local environment without having to modify the .lfsconfig file."

Related

git#gitlab.com: Permission denied (publickey,keyboard-interactive)

I have a Gitlab repository that contain a number of projects on all of which I can pull and push documents to with Git Bash. I want to set up new project. On the Gitlab website I have created the new project and am following the usual instructions in Git Bash:
cd existing_folder
git init
git remote add origin git#gitlab.com:new_project_name.git
git add .
git commit -m "Initial commit"
git push -u origin master
However when I try push (the last line of the above I get the error:
$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'git#gitlab.com:new_project_name.git'
(NB: the project name has been replace in this post by new_project_name)
There is a readme file that is ready to be committed.
I know I've missed something or done something incorrectly but I don't know what. I don't understand why I can push to other projects (the pull/ push is working fine) but not this one. What do I need to do in order to git push to the repo?

Create Git Log using Gitlab CI

We need to generate commit history file automatically when user commits code into git repository.
It can be done using Jenkins, Gitlab Webhooks and Jenkins Git Changelog plugin. Also, it can be created using below git command.
$ git log --pretty=format:'At %ci, %cN committed %h : %s' --decorate --graph >log.log
But, is there anyway we can generate commit history file using Gitlab CI/CD operations. The file can be saved in git repositry or local storage.
Sample Commit History File
* At 2018-11-16 18:02:21, kRiZ committed 1714a95 : Commit 4
* At 2018-11-15 16:06:06, kRiZ committed bab5c0c : Commit 3
* At 2018-11-14 18:05:09, kRiZ committed b3c9d86 : Commit 2
* At 2018-11-14 06:47:34, kRiZ committed 8e6ee30 : Add README.md
I'm sure there are multiple ways of doing this in GitLab. Here's one:
Create a .gitlab-ci.yaml file at the root of your repository. You can do this locally or using GitLab's web UI.
Paste this snippet into your .gitlab-ci.yaml file:
changelog:
image: docker:git
script:
- git log --pretty=format:'At %ci, %cN committed %h - %s' --decorate --graph >log.log
artifacts:
paths: [log.log]
Either commit and push locally or commit on GitLab's Web UI. The changelog job will be triggered.
After the job has finished successfully, your log.log file will be available as an artifact of the changelog job
Essentially, with this snippet you are setting up GitLab's CI/CD system to:
Use the Docker executor with a Docker image with git preinstalled
Define a changelog job that will run your git command
Define a log.log artifact that will be generated as part of the job and stored, so that you can download it afterwards.
I'd also recommend checking out the GitLab CI/CD quickstart
The library used by the Jenkins plugin also has a command line tool that can be used in anywhere:
npx git-changelog-command-line -std -tec "
# Changelog
Changelog for {{ownerName}} {{repoName}}.
{{#tags}}
## {{name}}
{{#issues}}
{{#hasIssue}}
{{#hasLink}}
### {{name}} [{{issue}}]({{link}}) {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
{{/hasLink}}
{{^hasLink}}
### {{name}} {{issue}} {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
{{/hasLink}}
{{/hasIssue}}
{{^hasIssue}}
### {{name}}
{{/hasIssue}}
{{#commits}}
**{{{messageTitle}}}**
{{#messageBodyItems}}
* {{.}}
{{/messageBodyItems}}
[{{hash}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*
{{/commits}}
{{/issues}}
{{/tags}}
"

fatal: 'user/test.git' does not appear to be a git repository

I created a repo in gitlab and set the user.name in a global way.
When I try to push my project, after inserting my password, I get the following error:
fatal: 'user/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
My .git/config:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git#gitlab.domain.tld:user/test.git
fetch = +refs/heads/*:refs/remotes/origin/*
output from "git remote -v:
origin git#gitlab.domain.tld:user/test.git (fetch)
origin git#gitlab.domain.tld:user/test.git (push)
What could be the problem?
Try using this:
git push https://username:password#gitlab.com/user/test.git
I've seen some issues in the newer versions of git that give me trouble when I don't specify the username and password every time. I'm sure there's a way around it but I haven't figured it out yet. Git recommends rolling back to older versions, but I'm sure there is a less drastic way.
In Settings you want to add with
git push https://yourusername:yourpassword#gitlab.com/user/test.git

GIT: Can't Push (Strange Config Issue)

I'm on a fresh install of Linux Mint.
I'm getting the following error when trying to push from any repository:
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 8 in /home/leng/.gitconfig
fatal: Could not read from remote repository.
This is very odd, because I definitely have a version that supports the simple push behavior.
The output of git --version is git version 1.8.3.2.
The contents of ~/.gitconfig:
[user]
name = My Name
email = MyEmail#website.com
[color]
ui = true
[push]
default = simple
Here's where it gets creepy.
If I change the behavior to matching (or to nothing, tracking, or current, for that matter), then attempt to push, I get the same exact error message. How is that possible? Is it caching the config somehow? I've even tried rebooting. I've even tried purging GIT completely from the system (and deleting ~/.gitconfig) then reinstalling it.
If I delete the [push] section completely from the .gitconfig file (or if I delete the file entirely), then try to push, then I get this:
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 8 in /home/leng/.gitconfig
fatal: Could not read from remote repository.
...so it appears to be both acknowledging that I haven't chosen a pushing behavior, but then also saying that I've chosen an unsupported behavior. What on earth is going on here?
I even get the error if I delete ~/.gitconfig completely.
Can anyone help me out with this witchcraft?
Thanks!
EDIT:
Here is a .git/config file requested:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://{my remote repo}
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Okay, so I fixed it, but the method is absolute witchcraft.
I tried to isolate the problem by purging GIT, deleting the config file, reinstalling GIT, then creating a local bare repository, then cloning it, then attempting to push from there. Pretty much like this:
sudo apt-get purge git-core
rm -f ~/.gitconfig
sudo apt-get install git-core
cd /git
mkdir foo
cd foo
git init --bare
cd /var/www
git clone /git/foo
cd foo
touch blah.txt
git add -A
git config --global user.name "Name"
git config --global user.email "user#email.com"
git commit -m "Blah"
git push
...same exact error message, no change there. (Still some serious witchcraft.)
Then, I deleted one of my repositories that doesn't have a local origin (it connects to its origin via SSH) and cloned the repository anew after deleting it (with a fresh git clone ssh://... command).
I got an error from the clone command:
remote: Malformed value for push.default: simple
remote: Must be one of nothing, matching, tracking or current.
Ah ha! Now it says remote instead of error. So the remote doesn't support this behavior. (That doesn't explain why the error persists on local-only repositories with local origins, then, though.)
So I then SSH'ed into the remote server and updated the git-core there to the latest version, re-attempted to clone the repository from my local machine, and it worked.
Now, I can finally git push. Insanely, this also fixed it so I can git push from the entirely local /var/www/foo to the also entirely local /git/foo (the local origin bare repository). SSH'ing into this remote server and updating it somehow - WITCHCRAFT - fixed my local machine's error.
Why on earth the entirely local repos care about an entirely different machine's GIT version is... beyond me. How utterly, utterly insane.
I had the same error message on git push.
For me it turned out that the remote user's git was an older version (1.7.2.5),
and I had recently updated the remote ~/.gitconfig to include:
[push]
default = simple
The solution was to remove this setting from the remote's configuration.
Since it seems other people are having this issue, and I found a solution HERE, I thought I'd post the solution that worked for me.
IN SHORT:
The solution I found was at this page. Evidently the best solution is to upgrade to a newer version of Git (if possible). That was not an option for me, however. From a local machine, I typed the following command:
git config -–global push.default upstream
This got rid of the Malformed value for push.default: simple error I had been getting. I'm not entirely sure what upstream does, however.
MY CONTEXT (for comparison): I had an empty (bare) repository on a remote computer, and I had a few repositories on a couple "local" workstations. I pull from the remote repository, do some work, and then push my work to the remote repository. Pushing/pulling was accomplished via SSH. Most of the time, while working on a local machine, pushing/pulling would result in the error described above.
In short, before the fix, I had the following ~/.gitconfig file on the remote machine:
[user]
name = Foo Bar
email = FooBarPerson#email.com
[diff]
external = /Users/foobar/bin/git-diff-cmd.sh
[color]
diff = auto
status = auto
branch = auto
[push]
default = simple
After entering in the above command, my ~/.gitconfig file on the remote machine changed to:
[user]
name = Foo Bar
email = FooBarPerson#email.com
[diff]
external = /Users/foobar/bin/git-diff-cmd.sh
[color]
diff = auto
status = auto
branch = auto
[push]
default = upstream
Version information:
Remote machine (repository location): 1.9.4
My laptop: 1.8.5.2 (Apple Git-48)
Other computer I work on: 1.7.7.4
Here's another site that may be useful to some people:
http://www.lorrin.org/blog/2011/10/03/argumentless-git-pull-and-git-push/comment-page-1/

git: creating remote branch failed

I tried creating remote branch devel using:
git push origin origin:refs/heads/devel
But it fails with:
error: src refspec devel does not match any.
error: failed to push some refs to 'git#***.com:***/abcd.git'
What's going on?
EDIT:
I am following: This Tutorial
If devel is your local branch, then this is sufficient:
git push origin devel
Your example doesn't work, because you try to push "origin" branch to remote repository ("origin"), but you don't have branch named "origin" (first origin here) in local repository.
You can run:
git push origin devel:refs/heads/devel
# ^ ^
# | +---- it's ref for remote branch to create
# +---------- it's local branch name
This second form is preferred if you local branch name should differ from remote branch name.
Did you make sure to do git add to all of your files first. Then git commit then git push?

Resources