INFO [050fe961] Running mkdir -p /home/rails/rails-
capistrano/releases/20140114234157 on staging-rails
DEBUG [050fe961] Command: cd /home/rails/rails-capistrano/repo && ( PATH=/opt/ruby/bin:$PATH GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/rails/git-ssh.sh mkdir -p /home/rails/rails-capistrano/releases/20140114234157 )
INFO [050fe961] Finished in 0.142 seconds with exit status 0 (successful).
INFO [2dea2fe5] Running git archive feature/Capistrano | tar -x -C /home/rails/rails-capistrano/releases/20140114234157 on staging-rails
DEBUG [2dea2fe5] Command: cd /home/rails/rails-capistrano/repo && ( PATH=/opt/ruby/bin:$PATH GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/rails/git-ssh.sh git archive feature/Capistrano | tar -x -C /home/rails/rails-capistrano/releases/20140114234157 )
DEBUG [2dea2fe5] fatal: Not a valid object name
DEBUG [2dea2fe5] tar: This does not look like a tar archive
DEBUG [2dea2fe5] tar:
DEBUG [2dea2fe5] Exiting with failure status due to previous errors
I am confused about two things:
Why is Capistrano running git archive here:
git archive feature/Capistrano | tar -x -C /home/rails/rails-capistrano/releases/20140114234157
Why is tar failing?
I had the same issue, until I realized I was pulling the nonexistent branch from git.
Deleting app_name/repo also fixed this issue for me.
This happens when the repo in the server to deploy is messed up. We're talking about the bare git repo that Capistrano by default would put in /var/www/$application/repo (for other people's reference).
In your case it does not have a local feature/Capistrano branch so when running git archive feature/Capistrano nothing is output to that | pipe. To confirm, ssh into the server, cd into /home/rails/rails-capistrano/repo, and run git branch.
It's running git archive as a way to export the selected branch's tree. git archive "writes it out to the standard output" so Capistrano redirects that to tar in order to uncompress the archive immediately into your new release directory.
(Why Capistrano chose this instead of git checkout defeats me.)
tar fails because it's receiving nothing d:
I can think of two possible solutions/ways to troubleshoot:
ssh into the server and manually delete the repo folder (e.g. in your case /home/rails/rails-capistrano/repo) as mentioned by #lugolabs
make sure the server's repo is using the remote you're expecting (ssh in, cd into repo/, and run git remote -v) -- you may just need to update your :repo_url in deploy.rb (and delete the repo/ dir).
I think that folder gets populated via a git pull, so it shouldn't be empty. If you do see it empty the issue is from the git not the tarball.
The issue I had was my capistrano deploy.rb repository URL was set to a different one than that project i was working in. In order to fix this issue, I also had to logon to the server and delete the app_name/repo folder which must have been caching the original bad remote URL.
Whenever I have hit this error it was because the branch specified in my deploy/environment.rb file wasn't checked into git. Do an add / commit / git push origin branch_name and that will likely make things work.
You can set your branch on deploy.rb with:
set :branch, "main"
source
Note: the default branch is master
I'm using Bedrock Roots (wordpress) for development, capistrano for deploys and git flow.
Stumbled upon this error when tried to deploy, while on hotfix/x.x.x branch locally. So I finished current (merged changes to develop branch) and then successfully deployed.
Related
How to use github cli to auto pull all newly created or updated repos to local pc?
I think I need to listen for new repo creation/updation and pull the repos. How to do it with cli?
If can't listen, I need to pull latest 100 repos to local machiene. How to do it?
I tried https://api.github.com/users/xxxx/repos?per_page=100. It gives in alphabetical order.
I use following code
#!/bin/sh
cat repolist.txt | while read line
do
REPOSRC=$line
LOCALREPO=$line
# We do it this way so that we can abstract if from just git later on
LOCALREPO_VC_DIR=$LOCALREPO/.git
if [ ! -d $LOCALREPO_VC_DIR ]
then
cd ~/xxxx
gh repo clone $REPOSRC
cd ~
else
cd ~
gh repo sync $REPOSRC -s $REPOSRC
fi
done
# End
The sort key
you're looking for seems to be sort=pushed.
Try curl -s 'https://api.github.com/users/xxxx/repos?sort=pushed&per_page=100' | jq '.[].name' to verify.
First off, I am not using command line git at all. I am only using SourceTree's gui interface. I would prefer to solve my problem this way; if possible.
Somehow, my submodule has become corrupted. Attempting to fetch or pull gives me the following error:
I haven't found any answers for this particular problem. I am fortunate in that my remote master is ok, 100% up to date, and I have no local changes. So, I think the easiest way will be to just fully reset my local submodule.
However, I can't figure out how to do so.
I considered trying to remove my submodule and then re add it. However, I have had problems with that in the past, and so am gun shy.
I found handfuls of posts about resetting to a specific commit. However, the SourceTree gui is failing to populate my history because of this error.
Any help would be appreciated
Thank you
You can try this
Right click at your conflicted branch at BRANCHES and delete it.
Double click at your remote branch at REMOTES to re-download and switch to that branch.
Easy, good luck.
I finally did get this fixed. I had to give up and use the command line.
I found this page (git fatal: failed to read object xxx: Invalid argument). That pointed me to using the "git fsck --full" command.
That pointed me to a very specific folder in the .git hierarchy that was corrupted.
I needed to delete this folder, but doing so wasn't easy. Windows would let me delete it. Not in safe mode. Not with cmd del or rmdir. I had to run a scan disk from windows on my entire drive. That ended up detecting the folder and removing it.
Finally, from there, I was able to fetch and pull master again.
From all the solutions I was able to find to perform an actually hard reset with proper cleanup and reinitialization of submodules nothing worked. So I ended up creating a custom script. Following will perform a full cleanup of your submodules and will recreate them as if you were cloning the parent repo.
#!/bin/bash
echo "Backing up current .gitmodules"
cp -f .gitmodules .gitmodules.bkp
has_submodules=$(echo "$(git submodule)")
if [ "$has_submodules" != "" ]; then
git submodule deinit --force .
rm -rf .git/modules
git submodule | cut -c43- | while read -r line; do (git rm -f "$line"); done
fi
cp -f .gitmodules.bkp .gitmodules
PARAMS=("path" "url" "branch")
CHUNKS=${#PARAMS[#]}
PARAMS_STR=$(IFS='|'; echo "${PARAMS[*]}")
readarray -t SUBMODULES_INFO_ARRAY < <(git config -f .gitmodules --get-regexp '^submodule\..*\.('"$PARAMS_STR"')$')
SUBMODULES_INFO_ARRAY_STR=$(IFS='|'; echo "${SUBMODULES_INFO_ARRAY[*]}")
function process_submodules_parsed_array()
{
name=${SUBMODULES_PARSED_ARRAY[0]}
path=${SUBMODULES_PARSED_ARRAY[1]}
repo_url=${SUBMODULES_PARSED_ARRAY[2]}
branch=${SUBMODULES_PARSED_ARRAY[3]}
echo "Running: git submodule add --force -b "$branch" --depth 1 --name "$name" -- "$repo_url" "$path""
git submodule add --force -b "$branch" --depth 1 --name "$name" -- "$repo_url" "$path"
}
echo "Parsing current .gitmodules"
for((chunk=0; chunk<${#SUBMODULES_INFO_ARRAY[#]}; chunk+=CHUNKS))
do
section_name="$(sed -nE 's/^submodule\.(.*?)\.'${PARAMS[0]}'\s(.*?)$/\1/p' <<< "${SUBMODULES_INFO_ARRAY[chunk]}")"
SUBMODULES_PARSED_ARRAY=("$section_name")
for ((param_i=0; param_i<CHUNKS; param_i+=1))
do
param_unparsed="${SUBMODULES_INFO_ARRAY[chunk+param_i]}"
param_parsed="$(sed -nE 's/^submodule.*?\.'${PARAMS[param_i]}'\s(.*?)$/\1/p' <<< "$param_unparsed")"
SUBMODULES_PARSED_ARRAY+=($param_parsed)
done
process_submodules_parsed_array
done
echo "Restoring .gitmodules"
mv -f .gitmodules.bkp .gitmodules
echo "Initializing submodules"
git submodule init
git submodule update
I tried to upload large file ( 240mb ) to github by lfs by using
- git lfs install
- git init
- git remote add origin "my repo url"
- git lfs track "*.weights"
- git add yolov3.weights
- git commit -m "test"
- git push -u origin master
after uploaded i found the file content
versionversion https://git-lfs.github.com/spec/v1
oid sha256:c49c28814dc8bcd2c48aac1c3e41c92a183cf9b282f6ca4c05f3d99393137952
size 246305388
And not working but the size still 240 mb
How to upload the file right or what is the wrong?
Did you try pushing the code using this command ?
git push origin <branch name> --force
HTTPS protocol can sometimes be unreliable when it comes to pushing large files . It may break unexpectedly
why dont you try pushing the code via SSH method ?
Run these commands below ::
ssh-keygen -t rsa -b 4096 -C "<email id>"
notepad ~/.ssh/<required key>.pub
// paste this public key into your github account
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<required_key>.pub
You can learn more about the ssh protocol in this article
Everything worked fine unit today.
Symantec/Antivir scanned and restarted my computer and afterwards my workspace looked like this.
Does anyone know what I can do?
How can I set the HEAD once a again?
In local the paths are all removed.
You can always clone the project again to get the latest code from the repository.
Another option is to execute fsck and recover from dangling files.
# Search for all uncommitted added files = dangling content
git fsck --full
# print out the content of the dangling content
git show <SHA-1>
If the content is commited simply use git reflog
More info in more detailed can be found here:
How to move HEAD back to a previous location? (Detached head)
A single line command, breached into multiple lines only for readability
# You can try recovering a branch by resting your branch to the sha
# of the commit found using a command like:
git fsck --full --no-reflogs --unreachable --lost-found |
grep commit | cut -d\ -f3 | xargs -n 1
git log -n 1 --pretty=oneline > .git/lost-found.txt
# Display the above commits
git log -p <commit>
# OR:
git cat-file -p <commit>
Now I know there are several questions like this on overflow but several of these answers have failed miserably for me. I am using Cygwin, if it is relevant. I ran
svn export https://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard
to receive the result:
svn: E170000: URL 'http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard' doesn't exist
I also ran
curl -L http://github.com/Wikia/app/tree/dev/extensions/wikia/AdminDashboard > project.tar.gz
to receive a .tar.gz file that 7-Zip fails to read the file giving the error:
Two remarks:
A GitHub repo would not work with svn command
the url does not exist.
A GitHub repo is best clone in its entirety, but you can do a sparse checkout as in this gist or this article:
New repository
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
Existing repository
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git read-tree -mu HEAD
If you later decide to change which directories you would like checked out,
simply edit the sparse-checkout file and run git read-tree again as above.