Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #72, #91 — getting git remote url #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions lib/middleman-deploy/strategies/git/force_push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,22 @@ def add_remote_url
end

def get_remote_url
remote = self.remote
url = remote
Dir.chdir('..') do
url = remote

# check if remote is not a git url
unless remote =~ /\.git$/
url = `git config --get remote.#{url}.url`.chop
end
# check if remote is not a git url
unless url.end_with?('.git')
url = `git config --get remote.#{remote}.url`.chop
end

# if the remote name doesn't exist in the main repo
if url == ''
puts "Can't deploy! Please add a remote with the name '#{remote}' to your repo."
exit
end
# if the remote name doesn't exist in the main repo
if url == ''
puts "Can't deploy! Please add a remote with the name '#{remote}' to your repo."
exit
end

url
url
end
end
end
end
Expand Down